Commit graph

56 commits

Author SHA1 Message Date
e1d0e3ec0b add basic compiler code 2019-06-01 20:33:43 -03:00
7d7aabbdd7 scanner: add keyword handling (copied off the old scanner)
as with most things, lol
2019-06-01 17:20:50 -03:00
d62c58a195 scanner: add identifiers 2019-06-01 17:15:35 -03:00
566d8313f3 add number tokens 2019-06-01 17:13:50 -03:00
9d1d253c94 scanner: fix peekNext 2019-06-01 17:12:00 -03:00
27b04e1612 scanner: add basic error handling, strings, comments 2019-06-01 17:07:22 -03:00
f4f1fe1fbc scanner: add whitespace handling 2019-06-01 16:54:15 -03:00
2c7cf356b3 scanner: add basic tokens and matched-tokens 2019-06-01 16:51:02 -03:00
6b9cc575d9 add draft scanner, remove messy Token union, replace by struct 2019-06-01 16:37:24 -03:00
63045e4df5 add src/new_scanner.zig 2019-06-01 16:21:36 -03:00
b80cd52c50 main: readd runPrompt and runFile
- main: make run() use the VM struct instance
2019-06-01 16:17:28 -03:00
a9dca436bd remove chunk running code, add draft compiler struct 2019-06-01 16:12:39 -03:00
088674bf0b vm: add dynamically-sized growing stack 2019-06-01 15:45:30 -03:00
3377d1675c vm, chunk: add binary operators 2019-06-01 15:40:18 -03:00
2822676707 vm: add negate opcode 2019-06-01 15:27:19 -03:00
61e463713c vm: add stack 2019-06-01 15:23:23 -03:00
456bc95138 vm: add debug flags 2019-06-01 15:01:39 -03:00
dae3c259fd add basic virtual machine code 2019-06-01 14:55:11 -03:00
14fa63e1f6 finish impl for ConstantLong 2019-06-01 14:18:44 -03:00
2d33e03efb add incomplete ConstantLong instruction
- move ValueList's count to usize for ConstantLong
2019-06-01 02:06:23 -03:00
ba78b39300 add constant values to the virtual machine 2019-06-01 01:46:01 -03:00
c4401dc8cf moving to the virtual machine part of the book, pt 1
the java part would still fuck me up since it lies on OOP stuff
that zig doesnt provide, so i'm skipping towards the C part of the book
which will hopefully be more understandable from a zig perspective.
2019-06-01 01:20:06 -03:00
727a259638 rm make_exprs.py, moving to the c part 2019-06-01 00:04:04 -03:00
6ff75a0926 finish make_exprs.py script
- add src/expr.zig
2019-05-31 23:43:46 -03:00
8007df6853 add mypy_cache to gitignore 2019-05-31 23:38:21 -03:00
3b73978f40 add make_exprs.py script 2019-05-31 23:37:45 -03:00
756f85d77d add multiline block comments 2019-05-31 22:45:23 -03:00
bba969922f add reading of keywords on doIdentifier 2019-05-31 22:39:53 -03:00
9d4c1249b4 add keyword map when scanner is initialized
- add basic identifier reading
2019-05-31 22:34:10 -03:00
69aa7b493d add number tokens 2019-05-31 22:08:41 -03:00
d1db7a0bd9 add consumption of comments and strings 2019-05-31 21:46:18 -03:00
9a2c50a53e add basic tokens and a basic lexer 2019-05-31 21:23:51 -03:00
31b0fa783c add file reads and main prompt 2019-05-31 17:07:08 -03:00
b3ea9637bd move to zig 2019-05-31 16:15:27 -03:00
3d26da0144 remove examples and main parser grammar
moving to lox described in https://craftinginterpreters.com
to go with. better learn something first, then walk towards things like
a static typed lang lol

anyways if you were here for jorts as my own language thing
do leave
2019-05-31 16:04:09 -03:00
a7034db0eb finish "parsing" of hello.jt
the AST is very ugly as it is rn. had to remove the cleanups or else its
all [[None], [None], ...]

ok im startnig to give up on doing handwritten lmao help

 - add TokenType.string
 - add read_value, read_statement, fix block reading
2019-03-10 03:04:37 -03:00
c2678fe360 better ast cleanup
- try to fix block parsing
2019-03-10 02:47:02 -03:00
92a365d908 ast_nodes: add ReturnType, Identifier, Import
handling of ReturnType follows the hello.jt rule, that it's implicitly
void.

 - add Reader.peek, a repr, Reader.expect_val, Reader.ignore
 - add _fn_ret_type for ReturnType generation
 - fix some things when reading named functions
 - add read_import
 - add handler for unexpected reserved word
 - add some ast cleanups on a read_loop
 - add ast skip when token is None
2019-03-10 02:38:52 -03:00
b7d5646bad add classes for AST nodes
- add Reader.expect, Reader.next_safe
 - fix fn_read_args, use TypedVar
 - use Reader.expect in read_function's post-fn check
 - use Function in read_function
 - add basics of blocks using { and } in read_start
2019-03-10 02:13:22 -03:00
7ce0565de7 add basics of a handwritten parser
hell yeah i'm going down that path

lark made confusing stuff, i'll probably get more confused with a
handwritten one, but oh well, such is life
2019-03-10 01:55:12 -03:00
9fda0b31c3 grammaer: more changes
i cant make sense of the errors lmao help
2019-03-09 20:05:03 -03:00
abdff4f65c put more things in grammar 2019-03-09 18:58:28 -03:00
09f230985e remove unused grammar file
since we're moving to lark
2019-03-09 16:58:46 -03:00
fe507437ea add install and usage to README 2019-03-09 16:54:47 -03:00
9e8a5abdaa package jortsc with setup.py
add lark parser as dep
2019-03-09 16:52:34 -03:00
a11d21873a finish basic token list 2019-03-09 00:02:13 -03:00
ece290e064 Merge branch 'master' of https://gitdab.com/luna/jorts 2019-03-08 23:43:56 -03:00
588b63fabe add basic lexer
also a draft grammar that i wont use probably
2019-03-08 23:43:17 -03:00
d12c913679 Merge branch 'master' of betseg/jorts into master 2019-03-08 22:15:09 +00:00
3caef4e7d6 Update 'examples/higher-order-functions.jt' 2019-03-08 22:14:08 +00:00