Commit graph

41 commits

Author SHA1 Message Date
fef
54a21f9121
vim: add gaybuild syntax file
This is sort of half-finished and probably full
of bugs, but it works for the most part.
At least it's nicer to look at than blank text.
2022-08-29 17:09:33 +02:00
fef
de42513728
lex: fix incorrect cursor position tracking
It works.  Finally.  This also fixes a stupid
off-by-one error that made the first token
disappear.
2022-08-07 19:46:09 +02:00
fef
ec8c8916b7
ast: allow definitions in loop head
This is a rather bad hack, but it makes parsing a
lot easier, so i'll allow it for now.
2022-08-07 17:49:58 +02:00
fef
57e74ab52a
require explicit variable declarations 2022-08-07 16:48:07 +02:00
fef
cb32a2c7e2
ast: remove unnecessary qualifier 2022-08-07 16:18:09 +02:00
fef
311059449a
rt: prevent deadlock in recursive functions 2022-08-07 15:37:46 +02:00
fef
192edca1a1
rt: add initial runtime implementation
Alright, so this is ugly.  I'm really not happy
with how it turned out for the most part, but
that's what refactoring is for.  For now, though,
i will sleep because i'm seriously tired.
2022-08-07 06:40:08 +02:00
fef
6c83d52053
ast: cargo fmt 2022-08-07 06:30:51 +02:00
fef
f5f29ed1e2
ast: save node positions 2022-07-31 17:42:10 +02:00
fef
bdb5f9ad4b
add dot operator for member access 2022-07-29 05:32:44 +02:00
fef
d9df6df402
add loops 2022-07-29 05:11:53 +02:00
fef
a86c2ec584
lex: fix single 0 recognition 2022-07-29 04:40:48 +02:00
fef
620be5dba1
add functions 2022-07-29 04:05:59 +02:00
fef
6d5e7cb406
lex: fix erroneous keyword recognition
I tried to parse a function called
"fn_with_callback" for the upcoming function
support and realized that the lexer mistook the
first two letters for the respective keyword.
So that is fixed now, i guess.
2022-07-29 03:37:20 +02:00
fef
dbcdee1c33
ast: unify function param and array parsing 2022-07-28 20:53:59 +02:00
fef
e932590bca
shit 2022-07-28 20:10:44 +02:00
fef
8bd25a3c6b
add true and false keywords 2022-07-28 20:10:14 +02:00
fef
0620ce0468
lex: remove ** operator
I don't think this would be useful, and it would
only complicate parsing due to its right
associativity, so it has to go
2022-07-28 19:56:55 +02:00
fef
cb98c78b37
add support for if statements 2022-07-28 19:52:15 +02:00
fef
05e73aeb21
ast: refactor and add production rule docs
As usual, this is nowhere near finished, but it's
a good start.
2022-07-28 18:38:36 +02:00
fef
40ea7598ae
ast: support parenthesized subexpressions 2022-07-27 19:59:18 +02:00
fef
e33c2022c5
ast: add expression support
This adds the basic set of expressions:
assignments, binary/unary expressions, function
calls, and array accesses.  Binary operator
precedence is also taken into account.  What's
still missing are parenthesized expressions, but
those should be easy to do.
2022-07-27 19:43:26 +02:00
fef
f71684bc38
lex: fix yet another token position bug
When skipping whitespace, the token position must
be updated accordingly.  Additionally, the token
position is now updated when creating a new one.
It still doesn't work because something with the
cursor is broken.
2022-07-27 02:26:56 +02:00
fef
50754ed26d
token: add helper functions 2022-07-27 02:24:52 +02:00
fef
10ca36535f
lex: add a couple more operators 2022-07-24 16:51:33 +02:00
fef
7b7cd933d3
rename module to target
To avoid potential confusion with Rust modules,
gaybuild's modules are now called targets.
2022-07-24 15:37:46 +02:00
fef
30273b7902
ast: add abstract syntax tree parser
This is nowhere near finished, but it's a good
start for now.
2022-07-24 14:06:09 +02:00
fef
b0e2e405d7
lex: fix buggy history 2022-07-24 14:05:11 +02:00
fef
8a0d22fbf0
test: add explanatory comments 2022-07-24 14:04:13 +02:00
fef
a8130c864d
cursor: break line after \n
Up to now, the cursor broke the line *before* the
\n and made that character the 0th one in the new
line.  I don't know why i did this, but at least
it's fixed now.
2022-07-24 14:03:38 +02:00
fef
7b715a2cfb
lex: fix incorrect keyword recognition 2022-07-23 20:52:15 +02:00
fef
c7e4244972
cursor: refactor to only work on strings 2022-07-23 20:51:15 +02:00
c7fc83f844
error: refactor into unified error type
This is probably a bad idea.  Every stage in the
compiler pipeline will use the same type for
emitting errors now (good), but it's doing so
using a bunch of wrappers (bad, i think).
2022-07-14 13:38:02 +02:00
8710d08a19
add IntelliJ config stuff 2022-07-14 13:05:15 +02:00
ba5c561c0e
improve error system
There is a generic error interface now that will
be used throughout the codebase.
2022-07-14 13:01:39 +02:00
73d1e8aede
lex: fix errors and cleanup 2022-07-14 12:33:04 +02:00
fef
50b6da41dd
lex: ignore comments
This is a cheap hack to just omit comments from
the token stream for now.  I doubt they will ever
be used at all, so their existence would just mean
extra work for the parser.
2022-07-11 16:08:11 +02:00
fef
68254757a3
lex: support backwards seeking and more tokens
The lexer now records every token it encounters
internally such that peeking and other useful
stuff is possible.  Will come in handy for the
parser.  Also, while i was at it, i also added
more primitive tokens like + - * / because i'm
probably gonna need it later anyway.
2022-07-11 15:57:01 +02:00
fef
8ae3bb2f57
add lexer and test file
There are most likely gonna be a lot of changes
until we reach the final syntax, but this is a
good start i think.
2022-07-10 21:56:00 +02:00
fef
0557369397
add cursor for lexer
This is a little helper for the lexer so it can
read a stream forwards and backwards.  It will
also keep track of line and column numbers for
better error output.
2022-07-10 17:00:47 +02:00
fef
991cf6caf0
initial commit uwu 2022-07-10 16:56:42 +02:00