Commit Graph

1294 Commits

Author SHA1 Message Date
greg
5d0648b9c0 Ignore Cargo.lock 2017-09-19 22:10:56 -07:00
greg
ba7a2e658f Don't track Cargo.lock 2017-09-19 22:10:56 -07:00
greg
ee12e10ac6 Fix slice syntax 2017-09-19 22:10:56 -07:00
greg
6a0b50f278 Kill hashmap import for now 2017-09-19 22:10:56 -07:00
greg
6c44d295db Framework for compilation 2017-09-19 22:10:56 -07:00
greg
cd69ebaa9d Split main() into subfunctions 2017-09-19 22:10:56 -07:00
greg
3fe9ec95d5 Fix repl error message 2017-09-19 22:10:56 -07:00
greg
8b5d1ecd15 Kill compilation for now
Don't wanna deal with this right this second
2017-09-19 22:10:56 -07:00
greg
272fa92052 More fleshing out 2017-09-19 22:10:56 -07:00
greg
0c717c721e Import Function type 2017-09-19 22:10:56 -07:00
greg
64d560a1fc Still more work 2017-09-19 22:10:56 -07:00
greg
8a92d5ffa8 Partial LLVM work 2017-09-19 22:10:56 -07:00
greg
5ed0ed727b Starting to add LLVM code 2017-09-19 22:10:56 -07:00
greg
5428810d2c Add llvm dependencies 2017-09-19 22:10:56 -07:00
greg
b48c007bca Get rid of old evaluator file
No longer need it
2017-09-19 22:10:56 -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
f33cfdadfe Fix variable lookup order
Evaluator uses frames as a stack, so to find the most-recent variable
binding we have to iterate through it the reverse way. This fixes a bug
manifested by:

fn a(x)
 x + 20
end

fn b(x)
 a(x) + 20
end
2017-09-19 22:10:56 -07:00
greg
231de69084 Added infrastructure for reading files 2017-09-19 22:10:56 -07:00
greg
f014c1a9d9 Kill compiler warnings 2017-09-19 22:10:56 -07:00
greg
c36bc3377e Fix lookup_binding in function call case 2017-09-19 22:10:56 -07:00
greg
5eba222679 Variable binding in fucntion call work 2017-09-19 22:10:56 -07:00
greg
dcf89aa429 Move lookup_function back onto Evaluator
THe problem was that we were borrowing the output of the inner HashMap,
if we clone it we don't borrow anything
2017-09-19 22:10:56 -07:00
greg
1ffbeb6472 Return last value out of function 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
77f72806be Add support for multiple frames 2017-09-19 22:10:56 -07:00
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