Git Product home page Git Product logo

ark's People

Contributors

7bitlyrus avatar acconut avatar andars avatar built1n avatar dansawkins avatar felixangell avatar haneefmubarak avatar ianhedoesit avatar ianmurray avatar inphi avatar kiljacken avatar lilithwittmann avatar movingtomars avatar naegelejd avatar nagexiucai avatar raoulvdberge avatar torwart avatar vnev avatar zhiayang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ark's Issues

Proposal: faster null checking

Instead of writing:

if (x == null) {

}

It would be cleaner to use a question mark, similar to other languages:

if (?x) {

}

The question mark would check if the right most object is null or not, if it's null the condition will be true and will execute.

Parse expressions

Parse expressions like:

int x = (5 + 5) - (a / b);

No idea what I was thinking when last night when I implemented the shunting yard algorithm and a stack for Expressions!? ๐Ÿ‘Ž

Pointers

Implementing pointers, yay or nay? If I were to implement pointers, I'd want them to be more distinguishable from the traditional syntax. Also, I don't want the asterisks since that would cause conflicts with multiplication.

int y = 50;
int ~x = &y;
x -> 12341234;
// or
~x = 123

bytecode compiler/interpreter thing

I've written a VM, it still needs work and theres probably a lot of pointer misuse in there too (lol) but we'll compile to bytecode for the VM. I'm not sure if we should handle expressions to generate code to evaluate the expression or if we should evaluate the expression and generate code for that?
@CaptainChloride You might wanna check out the VM, see if you can fix any errors. Also no clue how to handle decimals, strings should be a bit easier if we go for the C style.
Also I want == to compare strings, not have to do the C style !strcmp shit.

Jayfor doesn't compile on Archlinux

I have llvm 3.5 installed on Archlinux and I get error like: clang: error: linker command failed with exit code 1 (use -v to see invocation)

Here is the complete error message at http://pastebin.com/iGaVK3j7

It works when adding "-ldl -pthread" on line 22 in the Makefile. With -ltinfo, it doesn't work though.

VM

Need to fix that security-ish issue, add dynamic allocation for stack(?), finish adding instructions, etc, etc. @CaptainChloride something you can work on when you feel like it ;) ๐Ÿ˜‰

Undefined behaviour when tokenizing strings

Strings aren't being tokenized correctly, some characters will cause undefined behaviour.

fn just_a_test(string s): string {
    ret "this is a test";
}

The lexer will tokenize this correctly, and "this is a test" will be tokenized to Token("this is a test", STRING); However, this will not tokenize correctly:

fn just_a_test(string s): string {
    ret "this is a test !ยฃ wow %!";
}
``

Boolean expressions

Need these before I can parse while, if, do, and other logical statements.

arrays

we need to discuss this feature

Build Issues

Just tried building the compiler on my setup (OS X 10.10), ran into some issues:

  1. Why are you using C99 instead of C11?
    1b. Why are you doing some weird enum bool thing? <stdbool.h> exists for this purpose
  2. My compiler Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn) does not automagically link either ncurses or zlib -- thus adding -lncurses and -lz was necessary in order to get it to build.

2b. What is -ltinfo? is it terminfo? Apparently doesn't exist here.

Perhaps (2) is just differences in llvm-config output... Anyway I managed to get it to build!

Lexer character and line numbers are off

Pretty certain the lexer doesn't keep proper track of current character and line numbers. This should be stored for each token, which means error handling will be a lot easier.

When using an argument, jayfor does not throw not input file errors.

Without Arguments:

user@box:~/jayfor$ ./j4
error: no input files

With -d:

user@box:~/jayfor$ ./j4 -d
fopen: could not read file: Bad address
file: (null)

With -r:

user@box:~/jayfor$ ./j4 -r
fopen: could not read file: Bad address
file: (null)

With -o:

user@box:~/jayfor$ ./j4 -o
fopen: could not read file: Bad address
file: (null)

Improve error messages

This isn't very important, but once the code actually starts running, this will need to be improved.

Proposal: character shorthand

Characters can be defined with only one single quote, like so:

char x = 'a;

As opposed to having a closing single quote, saving a single character!!11111

We could still hold support for this syntax:

char x = 'a';

Oddities and Inefficiencies

I've done a brief look-through of the code, and I must say it's neat and well-commented. Unfortunately, I seem to have spotted something... weird.

void destroy_break_ast_node(break_ast_node *bn) {
    if (!bn) {
        free(bn);
        bn = NULL;
    }
}

There's a bunch of functions like that. if(!bn)... means that bn == 0, meaning you're passing NULL to free... then setting it to NULL again?

Something fishy is up here. Probably just an oversight/result of late-night coding, these happen.

Proposal: new for loop syntax

I like the jayfor syntax but the for loop could be like: for int x (0, 10), instead of for int x:(0, 10). I prefer for statement without colon because the parantheses already emphasize what is inside it.

Parse other data types

Currently there is a function that parsers integers, this should be pretty easy to change so it parses other data types.

structures

structures like this:

struct my_struct {
    int x
    int y
    float x
}

and structures with default values:

struct my_struct {
    float x = 0
    float y = 0
}

Fix default argument values

Since adding the new expression parsing, I've broken the default argument values:

fn this(int x = 5): void {

}

The x = 5 will not parse correctly as an expression.

Bug in parser.c

Line 1042 of parser.c looks like this:

data_type *data_type = malloc(sizeof(data_type));

In this case, sizeof(data_type) returns the size of the pointer declared on the same line, not the size of the data_type data type.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.