greg
e888e82404
Remove some unnecessary destructurings of Rc<String>
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
7eb48fb4ef
Working on compilation again
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
2996198eff
lookup_binding only needs &str
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
f158b6c712
Converted to multiple-evaluator logic
...
Now I have (basically) full single-step evaluation and it works fine
2017-09-19 22:10:58 -07:00
greg
ba8f67441f
Conditionals - handle delimiters correctly
2017-09-19 22:10:58 -07:00
greg
872e9ce7ee
Make function binding a SideEffect
2017-09-19 22:10:58 -07:00
greg
edf342e65a
Add == operator
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
1858d26638
Add comparison operators
...
+ make operator evaluation more concise
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
48343d3fad
Tightened tokenization tests
2017-09-19 22:10:58 -07:00
greg
4f8ff35d0f
fixed bug with ends_identifier
2017-09-19 22:10:58 -07:00
greg
7311d0311f
Simplify pattern a little bit
2017-09-19 22:10:58 -07:00
greg
1b59c264b4
Use itertools peeking_take_while
...
Cuts down on lines in the tokenizer
2017-09-19 22:10:58 -07:00
greg
b2e453a9de
Rewrite of tokenizer
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
e5ee072b00
Convert tokenizer to large match statement
...
In the hopes of making it shorter
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
7f52b20d97
Conditional eval partway implemented
...
Need to change the AST representation to support compound statements I
think
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
9cc9c5977d
Fixed evaluation of function calls
...
This bit still isn't quite small-step but maybe that's okay for
functions
2017-09-19 22:10:57 -07:00
greg
ed9d1312d1
Change representation of variables
2017-09-19 22:10:57 -07:00
greg
29d9e50311
All environment changes represented explicitly
...
Start the work of rewriting the evluator to be a true small-step
evaluator - that is, all state changes are represented explicitly as
SideEffect types, and not as methods called on the evaluator, except at
the very top of the evaluation loop
2017-09-19 22:10:57 -07:00
greg
e84550f3ec
Kill two compilation warnings
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
e1d07b4e66
Rustfmt on llvm_wrap
2017-09-19 22:10:57 -07:00
greg
af45004afa
Run rustfmt on some files
2017-09-19 22:10:57 -07:00
greg
d4d61ce5ad
Use process::exit in main
2017-09-19 22:10:57 -07:00
greg
743311d18a
Convert Tokenize to Result
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
fe8418edbe
Kill some extraneous spaces
2017-09-19 22:10:57 -07:00
greg
1d8102b9fa
Make compilation controllable
2017-09-19 22:10:57 -07:00
greg
aac3ca40fe
Add getopts
2017-09-19 22:10:57 -07:00
greg
c389b44bf8
Compile statements with variables
2017-09-19 22:10:57 -07:00
greg
db52f9b716
Package compilation context into one struct
2017-09-19 22:10:57 -07:00
greg
d3a743442b
= should have high precedence
2017-09-19 22:10:57 -07:00
greg
e46d840d96
Move more code to llvm_wrap
...
And silence a few compiler warnings
2017-09-19 22:10:57 -07:00
greg
3d406f1dd2
Move llmv wrapper into separate file
2017-09-19 22:10:57 -07:00
greg
fca307d3ab
Package more functions in LLVMWrapper
2017-09-19 22:10:57 -07:00