Commit Graph

127 Commits

Author SHA1 Message Date
greg
2681dbc4f2 Add test for "a+4" being conterintuitive
Also fix Op -> BinOp in tests
2017-09-19 22:11:00 -07:00
greg
d804efdc5e Use BinOp type instead of strings 2017-09-19 22:10:59 -07:00
greg
5911a07f4f Inline parsing of lambdas like half-works 2017-09-19 22:10:59 -07:00
greg
77297c7e06 Add lambdas 2017-09-19 22:10:59 -07:00
greg
1631bb0a04 Fix tests for conditionals 2017-09-19 22:10:59 -07:00
greg
1fa56800c5 Convert parsing while, if, fn exprs to use { } 2017-09-19 22:10:59 -07:00
greg
d23e5bff35 Add an Op type for binop operators
Soon this will get swapped in as the way that BinOps are evaluated
2017-09-19 22:10:59 -07:00
greg
3a4f5ae840 Change name Op -> OpTok
So that I can make an Op type for the ASTNode
2017-09-19 22:10:59 -07:00
greg
298194c42d Finish support for assignment operators 2017-09-19 22:10:59 -07:00
greg
23d2209d8b Implementing a few more operators
WIP - not done
2017-09-19 22:10:59 -07:00
greg
8651839a66 Getting rid of some newlines - concision 2017-09-19 22:10:58 -07:00
greg
f6e5ea250d Convert while_expr to delimiter_block! too 2017-09-19 22:10:58 -07:00
greg
9801f53a17 Moved conditionals to delimiter_block! syntax 2017-09-19 22:10:58 -07:00
greg
db92292569 Fixed all tests 2017-09-19 22:10:58 -07:00
greg
e1ce54aece Add delimiter_block macro 2017-09-19 22:10:58 -07:00
greg
c227ad656f Parser simplifications, renames, etc. 2017-09-19 22:10:58 -07:00
greg
b45d09e81a Don't need this reference 2017-09-19 22:10:58 -07:00
greg
761500b9d6 Some cleanups in Parser
-get rid of some use statements
-mkae error messages better
2017-09-19 22:10:58 -07:00
greg
328ec4ba87 Convertd like half the Strings to RC
-still need to eliminate some clones in eval, parse
+ fix all the tests
2017-09-19 22:10:58 -07:00
greg
4a7b570603 Parser changes - add precedences, move definitions
Move impls of Display for AST subtypes closer to where they are defined
2017-09-19 22:10:58 -07:00
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