Commit Graph

697 Commits

Author SHA1 Message Date
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
greg 09b67dc3f7 Change error message 2017-09-19 22:10:54 -07:00
greg a613fa73e5 Basic parsing framework 2017-09-19 22:10:54 -07:00
greg 8c473c554e Fix bug 2017-09-19 22:10:54 -07:00
greg 3e04cbfa29 Add comma tokenization 2017-09-19 22:10:54 -07:00
greg 570650cbfa Finish keyword tokenization 2017-09-19 22:10:54 -07:00
greg 49be163181 Add test to ignore
For better handing of user-defined operators, which I will do in the
future
2017-09-19 22:10:54 -07:00
greg b4f93acbd8 Couple more tests 2017-09-19 22:10:54 -07:00
greg 8c65ae3214 Macro-ize token tests 2017-09-19 22:10:54 -07:00
greg e436533638 Passing test 2017-09-19 22:10:54 -07:00
greg 4601a56867 Start working on tokenization tests 2017-09-19 22:10:54 -07:00
greg 2f7a1850db Finish tokenizing 2017-09-19 22:10:54 -07:00
greg 71aef379d3 Tokenize number literals
TODO: expand this bit of code to handle 0x12, etc. syntax
2017-09-19 22:10:54 -07:00
greg 8662a3ba0e Make tokenize error-able 2017-09-19 22:10:54 -07:00
greg 5ca98c7d77 Print tokeniziation 2017-09-19 22:10:54 -07:00
greg 13cde3106c Start making tokenizer changes
Hopefully this time iron out all the bugs from the last implementation
2017-09-19 22:10:54 -07:00
greg 09d524c74a Changing how parsing works again
Someone wrote a port of the LLVM kaleidoscope tutorial to rust, namely
https://github.com/jauhien/iron-kaleidoscope

I'm just gonna follow this along
2017-09-19 22:10:54 -07:00
greg 61c36c4def Fix assign parsing
= is a keyword not an identifier
2017-09-19 22:10:54 -07:00
greg bc4fbe4276 Start implementing definition
WIP, doesn't work
2017-09-19 22:10:54 -07:00
greg fc11ee753d Add block parsing
Right now evaluating a block reduces it to just the last AST in it, will
fix later with environments
2017-09-19 22:10:54 -07:00
greg dd2b4893a4 Get rid of Separator token
Have separate newline and semicolon tokens
2017-09-19 22:10:54 -07:00
greg 51745fd800 Make convenience macro for parse errors 2017-09-19 22:10:54 -07:00