ark-lang / ark Goto Github PK
View Code? Open in Web Editor NEWA compiled systems programming language written in Go using the LLVM framework
Home Page: https://ark-lang.github.io/
License: MIT License
A compiled systems programming language written in Go using the LLVM framework
Home Page: https://ark-lang.github.io/
License: MIT License
we need to discuss this feature
Probably wont fix this, but I am aware.
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)
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.
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.
jk
Not too important at the moment, fix later.
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';
I'll fix this in a bit.
i.e, given the following arguments...
j4 tests/simple.j4 -o folder/test.j4e
The folder will not be created, and the file won't be created.
got college work to do, cant do loads of work on the project for a few days.
@CaptainChloride @IanMurray
Not as consistent as I'd like them to be
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.
tup swag<int, double, str> = <0, 5.4, "swag">;
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.
This isn't very important, but once the code actually starts running, this will need to be improved.
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
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.
When I run
./j4 tests/for.j4
I get a segmentation fault. Not sure if its supposed to happen (if you're aware of this). Informing anyway
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
}
Simply changing return statements to actually say "return" instead of "ret" will make it a lot more readable and pleasant to look at!
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.
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 ;) ๐
Just tried building the compiler on my setup (OS X 10.10), ran into some issues:
enum bool
thing? <stdbool.h>
exists for this purposeApple 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!
do condition {
}
Do it bich
enum traffic_light_mode {
RED
ORANGE
GREEN
}
// make it so the parser can parse this line below
traffic_light_mode current_mode = traffic_light_mode::RED
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.
Need to decide if the language should be interpreted, write my own bytecode compiler, or use LLVM.
Need these before I can parse while, if, do, and other logical statements.
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 %!";
}
``
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!? ๐
@CaptainChloride
Currently there is a function that parsers integers, this should be pretty easy to change so it parses other data types.
Need to make it such that the file name can be specified before the arguments.
./j4 -o output.out tests/for.j4
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.
This will make it easier to improve error messages
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.