greg
|
9b54256521
|
Import types for breivty
and rename function to be explicit
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
087402ece6
|
Add more tests
Need to use box patterns
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
252b6e8bd9
|
Okay, this strategy makes the test work
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
b1163e2ae4
|
Operator-precedence parsing + tests
The tests are crippled now, because it's hard to write a test macro that
can also match on Strings
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
9a257f08d7
|
Introduce Op type
For operator parsing
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
1f7ae2e30f
|
Paren expression
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
e3c8753a4d
|
Expression parsing
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
31da25a66e
|
Expression parsing work
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
fff9cb7d25
|
Fix functin parsing
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
db1e188fdb
|
Move grammar to top of file
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
935185ed92
|
more parsing
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
0999cbe28e
|
More parsing work
|
2017-09-19 22:10:55 -07:00 |
|
greg
|
674f70a428
|
Convert parsing to method-based
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
b1b6672399
|
Implement function parsing
With a lot of dummy code, especially around expression parsing
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
bd1c455dc8
|
Basic infrastructure parses
Also got rid of EOF, don't need it
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
b62ef43f07
|
Add basic BNF grammar
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
a613fa73e5
|
Basic parsing framework
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
09d524c74a
|
Changing how parsing works again
Someone wrote a port of the LLVM kaleidoscope tutorial to rust, namely
https://github.com/jauhien/iron-kaleidoscope
I'm just gonna follow this along
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
61c36c4def
|
Fix assign parsing
= is a keyword not an identifier
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
bc4fbe4276
|
Start implementing definition
WIP, doesn't work
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
fc11ee753d
|
Add block parsing
Right now evaluating a block reduces it to just the last AST in it, will
fix later with environments
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
dd2b4893a4
|
Get rid of Separator token
Have separate newline and semicolon tokens
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
51745fd800
|
Make convenience macro for parse errors
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
971ab9ba21
|
Implement paren expressions
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
819fb3f58f
|
Basic evaluator functionality
Interpreter now works for simple arithmetic expressions
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
1c23329656
|
Add boilerplate for evaluation
Just wires everything up, doesn't actually evaluate yet
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
6da20cbfaf
|
Address compiler warnings
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
f48451125e
|
Parsing arithmetic expressions works
At the expense of an unnecessary move in lookahead()
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
06c3999430
|
Add expect_identifier function
For utility
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
1af1589550
|
Make Parser class internally use IntoIterator
And wrap the next() and peek() methods
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
32a90b8103
|
write expect
and also make the ParseResult type more general so it can be used for
more things.
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
186c900920
|
Implement expect macro
Seems like there's no way around passing in self manually
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
509ab80b9c
|
I can now parse one thing
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
247638c4db
|
Get parsing REPL working
|
2017-09-19 22:10:54 -07:00 |
|
greg
|
3af7e6a409
|
Refactoring Schala
Gonna work on Schala in earnest now! Using the simplerepl crate instead
of a build-in REPL, temporarily dropping parsing and evaluation code.
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
ddb09b453d
|
Implement booleans
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
9a4760d44f
|
Implement while-reduction
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
dffab8ae94
|
Fixed arg list parsing
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
48ee6c9a75
|
Add function name to parse
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
58d399dace
|
More function parsing
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
57ea1bae30
|
Preliminary addition of function blocks
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
e870d8172a
|
Make = a keyword
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
72b26755a7
|
Make ParseResult just a normal Result type
No reason for it to be different
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
1416c9d444
|
Parse null as simple_expression
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
be8c8b3343
|
Add paren test
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
b856023072
|
Fixed paren parsing
also made error reporting a bit nicer
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
868373f409
|
use match syntax in simple_parse
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
a947ec3cb2
|
Add simple parsing test
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
56b338a6a8
|
Move to global precedence table
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
7d6f946e22
|
Fill out a few more precedences
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
0da7f7e3a1
|
Fully fixed binop parsing
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
19a344fa77
|
Fixed precedent-less binop parsing
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
626a7f3861
|
Working on binop parsing
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
6ddea790c0
|
Beginning of variable lookup
everything is null
|
2017-09-19 22:10:53 -07:00 |
|
greg
|
d2108f0f97
|
First pass at evaluation
Very incomplete
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
2989ac338c
|
Implemented binop parsing
Uses Operator-precedence parsing algorithm, which I don't fully
understand.
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
8b6d54aec2
|
Fix let clause parsing
let a = x, x should be expression not just simple expression
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
cdb47bb3b9
|
Add paren parsing
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
8f9bfbc5bd
|
Rename rhs to simple_expression
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
c9fdd5e83c
|
Simplified statements-parsing
Still a little wonky wrt extraneous Separators, need to adjust grammar
to fix I think
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
30eddf7737
|
while statements
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
42719dc2f2
|
Change 'input' to 'tokens'
just to be consistent
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
8fcc850d77
|
Added else clause to if parsing
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
f421918945
|
basic if expression
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
edf100b583
|
Starting to do if statement parsing
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
46999beabf
|
Added skeleton of expression() parser
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
05238bced3
|
rhs production
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
a97cce184c
|
Empty program is valid too
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
329c521964
|
Parsing statement blocks works
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
bfa16fd6fb
|
Added Keyword lexical class
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
25f5188d8c
|
Move definition around
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
5213dd327f
|
Change type to peekable
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
cea29094cd
|
type alias for Tokens
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
67eafba97a
|
Put expect into early return macro
|
2017-09-19 22:10:52 -07:00 |
|
greg
|
1059a88ee6
|
Separate parsing into module
|
2017-09-19 22:10:52 -07:00 |
|