Commit Graph

968 Commits

Author SHA1 Message Date
greg
dcde5d6018 Start function call reduction
Move the varmap and funcmap functions to the Evaluator, to mkae it
easier to facilitate separate frames
2017-09-19 22:10:56 -07:00
greg
6bb227d052 Rename methods
make reduce() the entry point to evaluation
2017-09-19 22:10:56 -07:00
greg
29d4cb53a4 Add infrastructure to do function evaluation
Right now you can successfully evaluate a function definition (returning
Null), but cannot call a function
2017-09-19 22:10:56 -07:00
greg
3915c1f035 Remove println from reduction 2017-09-19 22:10:56 -07:00
greg
b400796e4d Get rid of test variable input 2017-09-19 22:10:56 -07:00
greg
96e6a87f64 Add string concat 2017-09-19 22:10:56 -07:00
greg
b1f9e5cefc Fix variable lookup 2017-09-19 22:10:56 -07:00
greg
be36d4697d Pretty-print evaluated AST nodes 2017-09-19 22:10:56 -07:00
greg
ce8c511929 Evaluate additional operators 2017-09-19 22:10:55 -07:00
greg
a8cafa8c64 Move Evaluator state into interpreter state 2017-09-19 22:10:55 -07:00
greg
229e6ae733 More expression parsing work 2017-09-19 22:10:55 -07:00
greg
e9dd0d9ae8 Add concept of Null expression
Finally, the null-only behavior is starting to manifest itself!
2017-09-19 22:10:55 -07:00
greg
15d4317191 Add null expression 2017-09-19 22:10:55 -07:00
greg
7114e446a4 Adding, subtracting works 2017-09-19 22:10:55 -07:00
greg
044f534ac5 Start implementing variable lookup 2017-09-19 22:10:55 -07:00
greg
d3207ad890 Move evaluation logic back into methods
They need to be able to access the environment which is stored in the
Evalator struct
2017-09-19 22:10:55 -07:00
greg
19fffd5063 Variable binding infrastructure 2017-09-19 22:10:55 -07:00
greg
785c916ece Start reducing ASTs
Start writing code to reduce AST nodes
q
2017-09-19 22:10:55 -07:00
greg
5a9ebb188d Make Evaluable trait 2017-09-19 22:10:55 -07:00
greg
16e8d969be Add basic evaluation 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
032d01c9f5 Fix tokenization bug 2017-09-19 22:10:55 -07:00
greg
c4ab1ed105 Fix tokenizer tests 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
47d56a7b44 fix 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
e1aa7ecb17 Finish tokenizing Op separately 2017-09-19 22:10:55 -07:00
greg
f09a6e14ba Tokenizer work to support operators
work in progress but committing to transfer
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