Commit Graph

107 Commits

Author SHA1 Message Date
greg
8ebf1b3056 Add parser support for while statements 2017-09-19 22:10:58 -07:00
greg
905431b33c Change name: ASTNode -> Statement 2017-09-19 22:10:58 -07:00
greg
06771979df Function bodies can contain statements now 2017-09-19 22:10:58 -07:00
greg
ba8f67441f Conditionals - handle delimiters correctly 2017-09-19 22:10:58 -07:00
greg
27d4c2ccbd No references in pattern-matching 2017-09-19 22:10:58 -07:00
greg
6794d22f1d Run rustfmt on eval.rs, parser.rs 2017-09-19 22:10:58 -07:00
greg
84fbe73cf6 Add Lambda type
And change name FuncNode -> FuncDefNode

Now function definition nodes reduce to a Lambda, which is not
reducible.
2017-09-19 22:10:58 -07:00
greg
ad994c38ae Test simplification 2017-09-19 22:10:58 -07:00
greg
59226eb731 Ran rustfmt on parser.rs 2017-09-19 22:10:58 -07:00
greg
297003c0b0 Operator only needs to be a tuple struct 2017-09-19 22:10:58 -07:00
greg
9b62efc830 Fix conditional parsing
Needed to account for semicolons/newlines. Maybe need to generalize
delimiter-separated list of things
2017-09-19 22:10:58 -07:00
greg
f626ca1427 Add test for conditional parsing 2017-09-19 22:10:57 -07:00
greg
82c52ede48 Finish evaluating conditionals 2017-09-19 22:10:57 -07:00
greg
12fee6158c Vector'd expressions don't need to be boxed 2017-09-19 22:10:57 -07:00
greg
2d21de7cc3 Added support for conditionals to parser
Not to eval yet
2017-09-19 22:10:57 -07:00
greg
3063de1242 Run rustfmt on the rest of them 2017-09-19 22:10:57 -07:00
greg
17f9846bb9 Make tests pass w/ new match syntax 2017-09-19 22:10:57 -07:00
greg
d3a743442b = should have high precedence 2017-09-19 22:10:57 -07:00
greg
5aa4c404a5 Added conditionals to grammar 2017-09-19 22:10:56 -07:00
greg
0e3aaa8b08 Add conditional expression support 2017-09-19 22:10:56 -07:00
greg
f8a521fc9b Start making function calls work
This commit isn't fully done yet
2017-09-19 22:10:56 -07:00
greg
be36d4697d Pretty-print evaluated AST nodes 2017-09-19 22:10:56 -07:00
greg
15d4317191 Add null expression 2017-09-19 22:10:55 -07:00
greg
70bf68d9bd More concision in parser 2017-09-19 22:10:55 -07:00
greg
f53c14535b Made error! macro more programtic
TODO implement Display on Token so we're not just displaying the debug
name of the token enum variants
2017-09-19 22:10:55 -07:00
greg
4f96abd7d9 Changes to make the code more concise 2017-09-19 22:10:55 -07:00
greg
fdaf4c302c Fix all compiler warnings 2017-09-19 22:10:55 -07:00
greg
8ce53d7c72 Fix bind error 2017-09-19 22:10:55 -07:00
greg
428d560e2a Add tests for call expr parsing 2017-09-19 22:10:55 -07:00
greg
80bc7ec089 Proper call expression parsing 2017-09-19 22:10:55 -07:00
greg
e6591b80d9 Add paren test 2017-09-19 22:10:55 -07:00
greg
e099f713ad Add binop parsing test 2017-09-19 22:10:55 -07:00
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