Commit Graph

33 Commits

Author SHA1 Message Date
greg 1abbe2e448 Add guard to Alternative
The semantics are:
    -if tag is Some(_), assume the condition is a constructor,
    and compare tags
    - if guard is Some(_), evaluate true/false *after* having
    applied any bound variables

With this, I can technically get rid of bare conditionals now, since
they are the same as an Alternative with a None tag
2018-08-27 12:45:08 -07:00
greg 8565c7dfb3 Some work on reduced ast pattern 2018-08-24 16:04:18 -07:00
greg fa7b6ce96b Handle negatives in patterns correctly 2018-08-21 19:57:45 -07:00
greg 492ef4ae19 Clear up some unused code to reduce compile noise
And add some notes to the README
2018-08-19 15:03:41 -07:00
greg 75a7a4499d Added some more cases to the match handling 2018-08-19 10:53:43 -07:00
greg 97bee58fbe More work with guards 2018-08-15 22:34:04 -07:00
greg 34c2b43371 More work on if matching 2018-08-15 18:32:44 -07:00
greg 88b617de52 More atlernatives work 2018-08-15 11:44:55 -07:00
greg 482674b19a Start on expr_or_block
WIP doesn't work yet
2018-08-15 09:34:00 -07:00
greg 0c0690e86e Provide error message here 2018-08-14 21:53:57 -07:00
greg 897c1181a9 Basic pattern matching working 2018-08-14 21:17:43 -07:00
greg f2ded78776 ReducedAST: Match -> CaseMatch
makes it easier to grep for
2018-08-14 12:37:18 -07:00
greg 8067c862f3 Switch out types for evaluator 2018-08-14 00:11:13 -07:00
greg f9c2fc3f9d Make code more concise 2018-08-07 17:09:53 -07:00
greg 5ead1e5d44 NewConstructor -> Constructor 2018-08-05 19:14:02 -07:00
greg 348a6f7c76 More work on pattern-matching
I think I need to entirely change the types in the evaluator.
ReducedAST should only care about NewConstructor (which I gotta rename),
and the evaluator is the only place that an implementation of a
primitive constructed type should live (see Peyton-Jones implementing a
functional langauge p. 70)
2018-08-05 19:11:42 -07:00
greg 5f336ec1a9 Add lookup_by_name to symbol table 2018-08-05 18:19:48 -07:00
greg da59fae0d3 More work on pattern-matching 2018-08-05 18:01:42 -07:00
greg 5b5689accf Changing representation of primitive objects 2018-08-05 17:15:58 -07:00
greg 32acf89814 New Constructor 2018-08-05 16:04:52 -07:00
greg c637a922a9 Start implementing constructors/matches
as per Implementing Functional Programming Languages by Peyton-Jones
2018-08-05 14:23:08 -07:00
greg bc6d4d19b5 reduced ast match 2018-07-26 00:52:46 -07:00
greg a2b1b0f953 Pattern-matching in reduced AST 2018-07-26 00:52:46 -07:00
greg 75bf4b5697 Fill out variants to be reduced 2018-07-26 00:52:46 -07:00
greg 90ecde89c9 Mutable types 2018-07-26 00:52:46 -07:00
greg 927f427a86 Starting work on patterns 2018-07-26 00:52:46 -07:00
greg 7882e92ab5 Fix old style if 2018-07-26 00:52:46 -07:00
greg f2dce38647 Broken, but compiling, move to new if paradigm 2018-07-26 00:52:46 -07:00
greg ebcea685f3 Fix looking up functions 2018-07-26 00:52:46 -07:00
greg 3b9084810e Add constructor reduced ast node; fix test 2018-07-26 00:52:46 -07:00
greg 7809cda240 Pass symbol_table to ast reduce
To distinguish between values and data constructors
2018-07-26 00:52:46 -07:00
greg f98d8e2bb0 Move AST into its own module 2018-07-26 00:52:46 -07:00
greg d0a0cc8209 Rename ast_reducing -> reduced_ast 2018-07-26 00:52:46 -07:00