- Added error severity, mainly to distinguish between READ and EVAL
errors, can be later expanded to allow other distinction
- Improved repl using the above function (EVAL errors interrupts the
repl right away, without the need to double-return)
- Added an helper function to provide infos about builtin and composed
functions
- Possibility to pass files as arguments to setup the environment
Signed-off-by: teo3300 <matteo.rogora@live.it>
Switched from Box to Rc (Yeah, I peeked at solution but I understood Rc
and RefCell just now) to allow multiple references to env data
Signed-off-by: teo3300 <matteo.rogora@live.it>
- Don't really like how it is behaving: turning expressions into a list
of expression and evaluating them separately
Signed-off-by: teo3300 <matteo.rogora@live.it>
- added `init` function, will be used later to implement functions
- moved `car_cdr` to `types.rs`
- improved some error messages
- implemented `do` and `if` special forms
- implemented comparison between numeric values (integers)
- improved comment
Signed-off-by: teo3300 <matteo.rogora@live.it>
Implemented `def!` to define new symbols into the current
environment, still need to implement `let*`
Added some helper functon for the eval phase
Defined a macro for more readable environment initialization
Signed-off-by: teo3300 <matteo.rogora@live.it>
- Error handling to signal what is preventing evaluation instead of
program crash
- Small editor feature (allow edit new
line of code to complete the previous ones instead of destroying the
input, if an empty line inserted return the error preventing evaluation
- Auto indentation on multiline input based on depth
Still does not parse multi-statement code
- This is a problem when dealing with macros: does not allow
expressions like `'()` since the atomic `'` hides the list ().
Need to chose between:
- Replace `'...` with `(quote ... )` during tokenization (may be
hard to implement macros later)
- Allows multi-statement code (this also allows to execute multiple
statements when reading a file)
Will probably delete auto-indentation since it breaks code's uniformity
too much
This step consists of creating the AST to represent the input
expression, the only evaluation done for now is the recognition of three
MalTypes for the nodes of the AST:
- Symbols: atomic isolated groups of characters
- Integers: Symbols that can be parsed as number and are treated as so
- Lists: recognizable by the presence of parentheses (only "()" for now,
"[]" and "{}" later), these can contain any number of MalTypes
The second half of this step (much easier) is to reconstruct the
original syntax (with clean whitespaces) to check the correctness of the
process
Signed-off-by: teo3300 <matteo.rogora@live.it>