Commit Graph

733 Commits

Author SHA1 Message Date
greg
c88d59401c Making main.rs more concise 2017-10-02 22:58:03 -07:00
greg
1aa4e3b942 Get rid of virtual machine code
Gonna implement this differently
2017-10-02 20:34:51 -07:00
greg
abbbb34901 Some very basic evaluation stuff 2017-10-02 20:11:27 -07:00
greg
3ff4a34aeb kill some non-used variable warnings 2017-10-02 01:52:46 -07:00
greg
7430aebe63 Webapp actually does something 2017-10-02 00:15:39 -07:00
greg
29d307ff53 Made web app a bit more useful 2017-10-01 23:25:36 -07:00
greg
89482e5b5a Use a Result 2017-10-01 19:31:43 -07:00
greg
6435d5e958 Make eval output nicer 2017-10-01 19:29:05 -07:00
greg
f6536e7ebd Evaluation stuff 2017-10-01 19:09:55 -07:00
greg
c5cb223168 Super-minimal type-checking with just ints 2017-10-01 17:50:26 -07:00
greg
d16a0c9380 Evaluation of literals 2017-10-01 12:55:28 -07:00
greg
daf9878020 Kill some unused code 2017-10-01 00:50:13 -07:00
greg
f825c87397 Type checking beginnings 2017-10-01 00:48:08 -07:00
greg
8d2a65b44e Starting eval framework 2017-09-30 23:30:02 -07:00
greg
6b9fee1aed Made handling parse errors nicer 2017-09-30 14:41:37 -07:00
greg
d05f173dd3 Using delmited! macro for more things 2017-09-30 14:11:38 -07:00
greg
e88a0f59b5 Made macro less complicatd 2017-09-30 13:46:50 -07:00
greg
90cf7db609 Use the delimiter macro in a few places
Made it capable of handling the strict <item> <delim> behavior necessary
for non-blocks, as well as teh loose behavior necessary for blocks,
added a test for a parse error.
2017-09-30 13:04:56 -07:00
greg
1ae9dbcba7 Tests for tuple type annotations 2017-09-30 01:14:49 -07:00
greg
9214f36c04 Tests for type annotations 2017-09-29 19:10:37 -07:00
greg
98169bd352 update test for new type anno format 2017-09-29 14:53:16 -07:00
greg
d60cf99ab5 Parsing sorta works
Need to handle double >> bug
2017-09-29 14:10:49 -07:00
greg
bb93d29beb Some type anno parsing work 2017-09-28 23:55:10 -07:00
greg
c20f93e18c A test for type annotation 2017-09-28 00:45:36 -07:00
greg
f48adbd9bf Made the tests work again 2017-09-28 00:06:08 -07:00
greg
9ad506fc78 Handling type annotations in the AST 2017-09-27 22:27:50 -07:00
greg
4c81c36d67 Parse type annotations
Not using them yet
2017-09-26 22:10:13 -07:00
greg
230f2dd7ff More match expr work 2017-09-21 16:00:14 -07:00
greg
4831a24853 yarn build script + rocket passthrough route 2017-09-20 23:21:45 -07:00
greg
8b83d982c0 More work on match expression 2017-09-20 21:05:08 -07:00
greg
6bff7aac0d Match expressions
not done yet
2017-09-20 20:30:30 -07:00
greg
7ac5846282 A tiny bit more work on the webapp 2017-09-19 22:11:05 -07:00
greg
0f9d2d76c4 Serve an actual file
Convert this to stdweb soon?
2017-09-19 22:11:05 -07:00
greg
006fd7d411 Trying webapp
Note this doesn't work yet
2017-09-19 22:11:05 -07:00
greg
e3b236a15d If expressions 2017-09-19 22:11:04 -07:00
greg
68bbd62ab6 Make token debug nicer 2017-09-19 22:11:04 -07:00
greg
e47a2c7241 Save REPL config to file 2017-09-19 22:11:04 -07:00
greg
a8b77848b4 kill old EBNF in comments 2017-09-19 22:11:04 -07:00
greg
839731f2d1 Make op! macro part of binexp!/prefexp! macros
For tests
2017-09-19 22:11:04 -07:00
greg
f51e1a3c47 make Operation a tuple-style struct 2017-09-19 22:11:04 -07:00
greg
fc350cd03e Prefix operators 2017-09-19 22:11:04 -07:00
greg
8fe7c85b00 return keyword + idea for how to use it in for 2017-09-19 22:11:04 -07:00
greg
b920fae93b variable bindings 2017-09-19 22:11:04 -07:00
greg
1981b74d89 Nicen up precedence-testing 2017-09-19 22:11:04 -07:00
greg
077ab8ddb8 Add trace to binexp parser 2017-09-19 22:11:04 -07:00
greg
9775bfc342 bool literals 2017-09-19 22:11:04 -07:00
greg
505d23a327 Parse . operator 2017-09-19 22:11:04 -07:00
greg
81c4566c2b Improved operator parsing 2017-09-19 22:11:04 -07:00
greg
8be757beca Some changes to EBNF grammar 2017-09-19 22:11:04 -07:00
greg
20c74953b5 Get rid of unimplemented! and panic! 2017-09-19 22:11:04 -07:00
greg
d5c3227966 Parse string literals 2017-09-19 22:11:04 -07:00
greg
fbeb101e7f make parse trace have newlines 2017-09-19 22:11:04 -07:00
greg
18c761a5b5 Wrap all parse methods in record-printing macro 2017-09-19 22:11:04 -07:00
greg
89cf101362 Refactoring prace trace infra 2017-09-19 22:11:04 -07:00
greg
66d10604ba make parse_method! macro more naturalistic 2017-09-19 22:11:04 -07:00
greg
565461e1db Show more useful information in parse tracing 2017-09-19 22:11:04 -07:00
greg
5ecd28d057 Print parse record in REPL as TraceArtifact 2017-09-19 22:11:04 -07:00
greg
6c5dbac406 Starting to add logic to track recursive descent calls 2017-09-19 22:11:04 -07:00
greg
5dd1cd79ff Parsing call expressions 2017-09-19 22:11:03 -07:00
greg
dfc89e5060 Index expressions
This only partially works
2017-09-19 22:11:03 -07:00
greg
5871bf68de test for function parsing 2017-09-19 22:11:03 -07:00
greg
34b569eb5f Starting to parse formal params 2017-09-19 22:11:03 -07:00
greg
5810fb7961 type alias test 2017-09-19 22:11:03 -07:00
greg
1a3076a949 Change syntax of rc macro 2017-09-19 22:11:03 -07:00
greg
1d9e5edfba Rudimentary type stuff 2017-09-19 22:11:03 -07:00
greg
555d2a7ba5 Identifier tests 2017-09-19 22:11:03 -07:00
greg
291fb61c8d Parse identifiers
Some more complicted types of expression
2017-09-19 22:11:03 -07:00
greg
685b579fdd paren exprs 2017-09-19 22:11:03 -07:00
greg
f72e77cbb6 Remove printlns 2017-09-19 22:11:03 -07:00
greg
4b5afef17e Added one more test 2017-09-19 22:11:03 -07:00
greg
5889998126 Precedence parsing
Using the Pratt parser algorithm (probably with some bugs as of yet).
Need to clean up the code some as well
2017-09-19 22:11:03 -07:00
greg
c19946bb6d Additional test 2017-09-19 22:11:03 -07:00
greg
d1301b30e6 Added infra for operators 2017-09-19 22:11:03 -07:00
greg
f8287e42ce Binary literal test case 2017-09-19 22:11:03 -07:00
greg
bd6bf2f4bb Parse binary literal 2017-09-19 22:11:03 -07:00
greg
a6b336d84c type anno EBNF 2017-09-19 22:11:03 -07:00
greg
deab74b992 Kill extraneous lines 2017-09-19 22:11:03 -07:00
greg
0755d42112 More parsing work 2017-09-19 22:11:03 -07:00
greg
117e0e38a8 Starting types 2017-09-19 22:11:03 -07:00
greg
3f1de5f60d Kill unused struct 2017-09-19 22:11:03 -07:00
greg
c52fd4c73d Parse test 2017-09-19 22:11:03 -07:00
greg
cac3ea86cf Import TokenType and Kw everywhere 2017-09-19 22:11:03 -07:00
greg
92ece39d5e Only IntLiteral
Signed/unsigned is via - operator
2017-09-19 22:11:03 -07:00
greg
14c09bb40c Float literals too 2017-09-19 22:11:03 -07:00
greg
0dabbc700b Concise-ify code 2017-09-19 22:11:03 -07:00
greg
741e5f7f9b Parsing basic numbers! 2017-09-19 22:11:03 -07:00
greg
cfefceabf9 More infra
Don't want EOF after all
2017-09-19 22:11:02 -07:00
greg
ea08f8cab8 More parse infra 2017-09-19 22:11:02 -07:00
greg
7d1c07c481 Parsing infrastructure 2017-09-19 22:11:02 -07:00
greg
7831cb8d8a Start parsing 2017-09-19 22:11:02 -07:00
greg
16d9e3eb60 Colored text for artifacts 2017-09-19 22:11:02 -07:00
greg
737dad6438 Added some tests
And commented out old tests for Maaru that don't compile
2017-09-19 22:11:02 -07:00
greg
74f8c16599 Fix bug with _ 2017-09-19 22:11:02 -07:00
greg
a82f24a158 Kill import 2017-09-19 22:11:02 -07:00
greg
6459ad28e8 A few more keywords 2017-09-19 22:11:02 -07:00
greg
57d4222746 Operators, keywords largely working 2017-09-19 22:11:02 -07:00
greg
88d1896281 Identifiers and keywords 2017-09-19 22:11:02 -07:00
greg
7fe0a6589e Unclosed string 2017-09-19 22:11:02 -07:00
greg
ac5bdd7bcb Change some func signatures around tokenizing and errors 2017-09-19 22:11:02 -07:00
greg
8bf5f40a2a Some string tokenizing - not done 2017-09-19 22:11:02 -07:00
greg
7e505dd88e Stuff 2017-09-19 22:11:02 -07:00
greg
f15427e5d9 A bunch of token stuff 2017-09-19 22:11:02 -07:00
greg
a53135a897 More elaborate tokens 2017-09-19 22:11:02 -07:00
greg
f3c8474c93 Add help entry
Would like to make this generalizeable
2017-09-19 22:11:02 -07:00
greg
8dc8d15437 Cleaned up Repl struct 2017-09-19 22:11:02 -07:00
greg
b5a6c5903e Switch to contentful output types 2017-09-19 22:11:02 -07:00
greg
c97e58c2aa Cleared out all remaining linter warnings 2017-09-19 22:11:02 -07:00
greg
cb9b56f000 Added back compilation 2017-09-19 22:11:02 -07:00
greg
55e1600b97 Kill old trait 2017-09-19 22:11:02 -07:00
greg
fb009497a4 Still more cleanup 2017-09-19 22:11:02 -07:00
greg
4b13fef734 More cleanup 2017-09-19 22:11:02 -07:00
greg
14ccf9f1be Converted Robo to new style trait 2017-09-19 22:11:02 -07:00
greg
7a6dfbbd0e Deleting old code 2017-09-19 22:11:02 -07:00
greg
bb3f85dd16 Getting rid of old code for maaru 2017-09-19 22:11:02 -07:00
greg
3e66568ddd Converted over Maaru to new schema
-partially...
2017-09-19 22:11:02 -07:00
greg
3abe299361 More work on new trait structure 2017-09-19 22:11:02 -07:00
greg
626b17cbd2 Idea for trait redesign 2017-09-19 22:11:02 -07:00
greg
192a7e611f Parsing BNF 2017-09-19 22:11:01 -07:00
greg
d3febb201b More parsing 2017-09-19 22:11:01 -07:00
greg
f9fe81993f Beginning parsing code 2017-09-19 22:11:01 -07:00
greg
ff01d4b798 Initial Schala (for real) commit 2017-09-19 22:11:01 -07:00
greg
dd22ca0291 Grand renaming of things 2017-09-19 22:11:01 -07:00
greg
801896bcc6 Starting to add code for vm 2017-09-19 22:11:01 -07:00
greg
5d15d60ab6 Structs implemented
albeit very inefficiently
2017-09-19 22:11:01 -07:00
greg
9dd8f90e3c Only print last evaluated result 2017-09-19 22:11:01 -07:00
greg
e0f5f01e69 Kill error messges for not using Result 2017-09-19 22:11:01 -07:00
greg
424998c128 Lists work! 2017-09-19 22:11:01 -07:00
greg
b93625819c Update ReducedValue to handle lists 2017-09-19 22:11:01 -07:00
greg
f90bfb88ca Fix display of list 2017-09-19 22:11:01 -07:00
greg
850b77541b Display of lists sorta works 2017-09-19 22:11:01 -07:00
greg
dbf5886aad List evaluation technically working 2017-09-19 22:11:01 -07:00
greg
dd93adf5b7 try!() -> ? 2017-09-19 22:11:01 -07:00
greg
d8df98ba01 Beginnings of list literals 2017-09-19 22:11:01 -07:00
greg
4da771036a Part of evaluation path for indexing done 2017-09-19 22:11:01 -07:00
greg
3911c45dde Introduced index notation 2017-09-19 22:11:01 -07:00
greg
f3c3d4595e Immediate lambda call 2017-09-19 22:11:01 -07:00
greg
e4a42e7691 Add back eval printing 2017-09-19 22:11:01 -07:00
greg
cc537f292d Starting Maaru AST 2017-09-19 22:11:01 -07:00
greg
840e093bc4 Maaru - token work 2017-09-19 22:11:01 -07:00
greg
815f2b8242 Starting work on Maaru tokens 2017-09-19 22:11:01 -07:00
greg
34dba9cc4d Schala - fix bug with comments 2017-09-19 22:11:01 -07:00
greg
6e28ae68a0 Add options 2017-09-19 22:11:01 -07:00
greg
48b0b8d053 Add logic for picking language with command line flags 2017-09-19 22:11:01 -07:00
greg
e0c49abe56 Change show-llvm opt to -v 2017-09-19 22:11:01 -07:00
greg
65dc362a1d Killed some warnings, cleaned up some code 2017-09-19 22:11:01 -07:00
greg
8ff1c632c2 Make REPL friendlier 2017-09-19 22:11:01 -07:00
greg
039022bfc5 Get rid of println 2017-09-19 22:11:01 -07:00
greg
387ec25cda Fix bugs in interpreter argument parsing 2017-09-19 22:11:01 -07:00
greg
ecf60198fa Can now switch between languages in the interpreter 2017-09-19 22:11:01 -07:00
greg
f83cece2b4 Import Maaru into main 2017-09-19 22:11:00 -07:00
greg
8fd5fb5a0b Added language name functionality 2017-09-19 22:11:00 -07:00
greg
455fe2abe2 Get rid of stand alone evaluator 2017-09-19 22:11:00 -07:00
greg
902c85ccd7 Fully implemented state
If I make the LanguageInterface trait over a pair of language and
evaluator, then it works :)
2017-09-19 22:11:00 -07:00
greg
4ea600d55c Abstracted most work into LanguageInterface trait
Still need to handle state
2017-09-19 22:11:00 -07:00
greg
6dec35d460 Think I've nearly gotten it traitified correctly... 2017-09-19 22:11:00 -07:00
greg
cc855affbf Make Maaru structs public 2017-09-19 22:11:00 -07:00
greg
a303aa2a5b Add first new language - Maaru
Maaru is intended to be a haskell-ish functional language.
Here's enough of a skeleton to print a thing
2017-09-19 22:11:00 -07:00
greg
421a9a7e9b Abstract evaluation into EvaluationMachine trait 2017-09-19 22:11:00 -07:00
greg
f37ab80163 Fix tests 2017-09-19 22:11:00 -07:00
greg
178434171e Cleaning up some types 2017-09-19 22:11:00 -07:00
greg
fd4610e175 Make newtype for LLVM code strings 2017-09-19 22:11:00 -07:00
greg
5103f03fa5 Forgot to add mod.rs file 2017-09-19 22:11:00 -07:00
greg
1a4bf24ab1 Move schala-specific stuff into its own module 2017-09-19 22:11:00 -07:00
greg
9d6bdf22da More conversions to trait version 2017-09-19 22:11:00 -07:00
greg
8326a12c9c (Largely) trait-ify Schala
The idea is to provide a trait `ProgrammingLanguage` that actually does
all the work, and then main.rs will just be the infra for storing its
own state
2017-09-19 22:11:00 -07:00
greg
5e474231da ProgrammingLanguage types need Debug 2017-09-19 22:11:00 -07:00
greg
1ac440c8df Implement trait parse 2017-09-19 22:11:00 -07:00
greg
f5022a771c Starting work to trait-ify language 2017-09-19 22:11:00 -07:00
greg
eaf86ea908 Add support for +, - in num literals 2017-09-19 22:11:00 -07:00
greg
eb6354e55a Only print errors if the programs failed 2017-09-19 22:11:00 -07:00
greg
751c6f65bd Deleted some code in compilation 2017-09-19 22:11:00 -07:00
greg
3e231b4715 Use native rust to write source file 2017-09-19 22:11:00 -07:00
greg
e103ba221c Conditionals work! 2017-09-19 22:11:00 -07:00
greg
d5f01a7b1f Continuing work on phi nodes 2017-09-19 22:11:00 -07:00
greg
1702163478 Add flag for llvm 2017-09-19 22:11:00 -07:00
greg
bdd6f75cf6 Show/hide LLVM IR in REPL 2017-09-19 22:11:00 -07:00
greg
2681dbc4f2 Add test for "a+4" being conterintuitive
Also fix Op -> BinOp in tests
2017-09-19 22:11:00 -07:00
greg
9454fc6194 Add return statements to generated functions 2017-09-19 22:11:00 -07:00
greg
c8feaa9b57 Add logging of supplimental commands 2017-09-19 22:11:00 -07:00
greg
518414ffd5 I was doing a wrong thing with creating vecs
The old vector was getting dropped and thus free-ing the old
underlying slice. I want to use set_len() on Vec to do
this
2017-09-19 22:11:00 -07:00
greg
06a5de6e32 Trying to debug this segfault 2017-09-19 22:11:00 -07:00
greg
748a85db02 Compiling functions half-works 2017-09-19 22:11:00 -07:00
greg
8f2d9b900b Function codegen sorta works 2017-09-19 22:11:00 -07:00
greg
b9d1140264 Refactored op compilation code
+ moved to separate function
2017-09-19 22:11:00 -07:00
greg
7188a7d33e Clarified that we hardcode a "main" function
in compiler data structure
2017-09-19 22:10:59 -07:00
greg
0c7099771f Comparison operator working 2017-09-19 22:10:59 -07:00
greg
afec7e829c There's some segfault happening in LLVMBuildUIToFP 2017-09-19 22:10:59 -07:00
greg
a6773d59bd Refactoring in compiling binops 2017-09-19 22:10:59 -07:00
greg
d804efdc5e Use BinOp type instead of strings 2017-09-19 22:10:59 -07:00
greg
0ace370fc2 Tightened up REPL loop 2017-09-19 22:10:59 -07:00
greg
1f50fcc620 Improvments to interpreter directives parsing 2017-09-19 22:10:59 -07:00
greg
d7181afa91 Few more linefeed-related changes 2017-09-19 22:10:59 -07:00
greg
4eb7683f47 Move linefeed reader to struct 2017-09-19 22:10:59 -07:00
greg
b04a8f0092 Add back interpreter directives 2017-09-19 22:10:59 -07:00
greg
c50be58cd2 Moved from simplerepl to lineread crate 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
26bc6e90f3 Lamba calls partially work 2017-09-19 22:10:59 -07:00
greg
b0655d7cab need to flush stdout for printing 2017-09-19 22:10:59 -07:00
greg
a46ede9395 Made evaluation-printing more sophisticated 2017-09-19 22:10:59 -07:00
greg
d9ab5a58cf Add some methods to llvm_wrap 2017-09-19 22:10:59 -07:00
greg
77297c7e06 Add lambdas 2017-09-19 22:10:59 -07:00
greg
d93b5c0a2e Still cranking away at conditional compilation 2017-09-19 22:10:59 -07:00
greg
0b9dc113d1 CLoser to working now 2017-09-19 22:10:59 -07:00
greg
d6fc13f08d Fix a couple of problems 2017-09-19 22:10:59 -07:00
greg
825c271b17 More work on codegen for conditionals
Still doesn't compile
2017-09-19 22:10:59 -07:00
greg
8c4f7e141a Compiling if statements like half done 2017-09-19 22:10:59 -07:00
greg
12fbc51da1 Compile multi-expression source programs 2017-09-19 22:10:59 -07:00
greg
7ddb421ced Exit cleanly on opt parse fail 2017-09-19 22:10:59 -07:00
greg
1631bb0a04 Fix tests for conditionals 2017-09-19 22:10:59 -07:00
greg
5923cc2317 Kill then, else keywords 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
2b4d3e8516 Add support for curly braces and brackets
Gonna make this a curly-brace language, I like those better. Shoulda
done that to begin with.
2017-09-19 22:10:59 -07:00
greg
9b74527618 Control printing eval steps with flags 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
4cf165b408 Use buffered reader for stdout
Not sure ifthis is actually helping
2017-09-19 22:10:59 -07:00
greg
154839979b Add nicer handle_builtin method 2017-09-19 22:10:59 -07:00
greg
538f0b18f4 Evaluate while loop 2017-09-19 22:10:59 -07:00
greg
dc81d237c5 Reduce re-allocations in eval 2017-09-19 22:10:58 -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
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
greg
a65544356c Fix bug in delete routine 2017-09-19 22:10:57 -07:00
greg
10d51cc29c Compile binexps 2017-09-19 22:10:57 -07:00
greg
95b773de7f Compilation sequence
-move all steps of the llvm IR compilation process into the binary
2017-09-19 22:10:57 -07:00
greg
c032da712f Successfully compiling a main function 2017-09-19 22:10:57 -07:00
greg
cfb93d9dea Compilation that returns an output code works 2017-09-19 22:10:57 -07:00
greg
08798fb690 Move all LLVM functions into LLVMWrap
so I can kill the global unsafe
2017-09-19 22:10:57 -07:00
greg
e0eef5e58f More moving functions around 2017-09-19 22:10:57 -07:00
greg
2107e6344e More function wrapping 2017-09-19 22:10:57 -07:00
greg
2ad65a1c5d Some in-progress work 2017-09-19 22:10:57 -07:00
greg
a01b6c874e Small-step function arg evaluation 2017-09-19 22:10:57 -07:00
greg
907af38f44 Evaluate printing 2017-09-19 22:10:57 -07:00
greg
923566c4e9 Get rid of println's for token/ast debugging
Instead just explicitly stick them into the returned string.

This is necessary 'cause I'm gonna convert simplerepl to use ncurses
soon, so I can't have any side effects
2017-09-19 22:10:57 -07:00
greg
96c51a9b88 Move some more unsafe code into block 2017-09-19 22:10:57 -07:00
greg
8528c912bd Added side effect framework 2017-09-19 22:10:57 -07:00
greg
47f4c25020 Doing some wrapping 2017-09-19 22:10:56 -07:00
greg
c18c1a639a compilation does something usefl
Following along with:
http://blog.ulysse.io/2016/07/03/llvm-getting-started.html
2017-09-19 22:10:56 -07:00
greg
d3f6bbabaa Starting to add actual LLVM generating code 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