Commit graph

20 commits

Author SHA1 Message Date
f4ddaeb11d minor fixups 2024-08-29 02:57:58 +02:00
b425a59db5 added closures 2024-08-28 23:58:55 +02:00
4496875ba3 fixed two bugs
calls are now parsed recursively, i.e. multiple in a row
is_in_fun is now false by default
2024-08-28 22:41:00 +02:00
b717b91ee5 implemented function calls 2024-08-28 17:29:36 +02:00
be931b7214 implemented calls 2024-08-27 20:32:05 +02:00
8d445cc9e4 changed tokens from mutable to ref
so that when record is copied it's still the same field
2024-08-27 19:00:11 +02:00
94ccf91689 fixed bug wih with_is_in_loop 2024-08-27 18:25:12 +02:00
6206ee4a00 moved mutable part of state inside mutable field
since only `tokens` is actually mutable we can make that field mutable,
and hence not have to deal with `state ref`s, and only have a single
mutating function, i.e. `advance`.
2024-08-27 18:01:34 +02:00
be28dad67e moved for loop to separate Stmt and added continue 2024-08-27 17:15:35 +02:00
e288a626fd implemented break 2024-08-27 02:46:17 +02:00
3bc871d434 implemented while and for loops 2024-08-27 01:57:47 +02:00
dbcdbc216f added If, And, Or 2024-08-26 17:26:59 +02:00
77e57cd8c2 global and local variables with scope
also reworked arg parsing, now has --debug flag
2024-08-26 01:58:03 +02:00
b4e25ee561 fixed parser bug by filtering out all comments 2024-08-25 03:07:18 +02:00
ea0d7acbee started implementing expressions
Parser.parse now return list of statements or list of errors.
parsing continues until EOF, even when errors are found; but after the
first error the result can only be Error.
Also implemented Print and Expr statements.
2024-08-25 02:12:51 +02:00
a8290a4104 moved exprs into nodes with code position 2024-08-17 13:32:59 +02:00
485ecebdf3 reworked parser error handling
now based around result; since each parsing step can emit at most one
error until synchronisation is triggered we can store the errors in the
result.

also state is now stored in a ref variable. the copy-and-update is more
pure, but really messes up the let* expression for the expr/error
results.
2024-08-14 14:15:01 +02:00
f14677b6f5 fnished first draft of expression parser 2024-08-14 12:36:36 +02:00
3bd18634d5 implemented parsing up to neg/not 2024-08-12 18:28:21 +02:00
3590a78154 more work on the parser 2024-08-12 16:31:28 +02:00