Exercises and programs based on this tutorial.
Added program prompt.c
- Added a simple user prompt
- Released lispy v0.0.1!
- Support for readline and command history.
- Proper error handling of input
- No limit on size of input
- Linked readline library
- Update Makefile
- Released lispy v0.0.2!
- Fixed typo
- Define TRUE/FALSE in prompt.c
- Added mpc as submodule
- Symlinked mpc.h and mpc.c
- Solved some exercises of Chapter 06 at exercises.md
- Created Parsers for 'Reverse Polish notation' and defined language using Regex
- Modified prompt to echo ast on correct syntax or, display error
- Cleanup mpc parsers at exit
- Released lispy v0.0.3!
- Added modulo(symbol
%) in list of operators - Realized parsers doesn't handle bad input (eg: Bad number of operands)
- Added .clang-format
- Formatted prompt.c
- Updated .clang-format
- Added .gitignore
- Initial support for evaluating expressions
- Added some comments
- Renamed some functions
- Refactor if-else
- Removed debug print statments
- Released lispy v0.0.4!
- Removed unnecessary function to calculate total number of nodes
- Move evaluation of ast to seperate header
- Add some documentation
- Updated Makefile to include eval
- Store numbers and errors as
LVal's (Lispy values) - Create methods to operate on
LVal's - Modify
evalandcalcfunctions to accept and returnLVal's - Add some kind of error handling using enums
- Note:
LERR_BAD_OPis handled by parser... - Modified Makefile to include lval.c
- Removed unnecessary includes from files
- Disabled evaluation for refactoring
- Removed a lot of memory leaks present from Day 1
- LVal struct now holds more fields
- Error are now strings
- A lot of dead code present
- Program compiles and gives correct output
- Document public/private functions in lval.c
- Evaluate expressions
- Print result of expression rather than expression itself
- Released lispy v0.0.5!
- Added support for Quoted(Q)-Expressions
- In lang (
{}) - In LVal types
- In lang (
- Use macros for simplifying code (
LASSERT) - Refactor code for DRY
- Added logic for handling
qexpr - Derived
sexprfunctions for use withqexpr - Added operator for
qexprlike head, tail, etc.
- Updated prompt to display lispy version v0.0.5
- Added documentation
- Divided source file using comments
- Released lispy v0.0.6!
- Forward declare structs
LVal,LEnvalong with theirtypedef's - Forward declare function pointer
LBuiltin - Update
LValstruct to includeLBuiltin - Declare all public functions of lval.h inside lval.c
- Remove dead code inside lval.h
- Restructure lval.c
- Added comments in lval.c
- Updated prompt.c and Makefile to use libedit instead of readline
- Also added a newline character to exit message
- Commit to make shorter discriptive commits!
- Define
LEnvstruct - Modify
lval_wrap_errto parse variable arguments as error string - Add
LValwrapper forLBuiltin's - Add function to print type of
LVal - Add logic to handle
LBuiltinsinlval_del,lval_print - Add a function to deep copy
LVal's - Commented some functions
- More re-ordering and restructuring of files
- Declare and define functions to operate on
LEnv's - Finally have an idea of how
lenv_getworks- i.e the lval passed is itself a symbol instead of a value
- Updated
LASSERTto be variadic - Added other assertions
- Added some documentation on the macros
- Breaks previous
LASSERT's
- Fix
LASSERT_NOT_EMPTYto check for children of child ofLValinstead, of child itself - Update various builtins signature to pass
LEnv's - Rename
LASSERT_*toLASSERT_CHILD_*for explicitness - Accidentally replaced all
a's withlvalin comments..- Similarly with
eandlenv - Resolved using my superb REGEX skills and determination!
- Similarly with
- Also made some corrections along the way to comments
- For some weird reason I find
An LVal, An LEnvmore natural than usingA ... - Builtins like list, head, tail, eval, etc. now also require passing an LEnv
- Passed an
LEnveven when not required, - which led to -Wunused-parameter which was resolved adding a
voidstatment
- Passed an
- Added modulo operator logic in
builtin_opwhich to my suprise was missing! - Added methods to declare and intialize
builtin's insideLEnv's
- Update signature and definition of
lval_eval*to acceptLEnvfor getting symbols - Also updated their documentation
- Improved error-handling in
lval_eval_sexpr - Fixed
lval_evalsignature inbuiltin_eval(which should have been fixed already in earlier commits...)
- Update documentation for
lval_evalfrom previous commit - Made some
LEnvrelated functions public for prompt.c - Created a global
LEnvfor storing session symbols in prompt.c - Updated
symregex - Still need to debug some memory managment issues but somewhat complete
- Like dumps core on passing wrong number of arguments to
def - Reachable blocks are still present even after moving from readline to libedit
- Like dumps core on passing wrong number of arguments to
- Turns out: > - Like dumps core on passing wrong number of arguments to
def- Dumps core for every builtin
- Fixed the above described bug by removing typo s/
sizeof(MAX_ERR)/MAX_ERR - Fixed some error string formatting
- Add modulo to list of symbols
- Still a bit hazy how
LBuiltin's work as a whole.. - Released lispy v0.0.7!
- Modify
LValstruct to have additional fields related toLBuiltin's - s/
fun/lbuiltin
- Added wrapper function for lambda expressions
- Fixed a typo
- Added cases for
LVAL_FUNto handle builtins and user-defined lambda expressions - Code does not compile due to
lenv_copynot defined
- Builtin for lambda expressions
- Added builtin to
lenv_add_builtin - Still does not compile, due to previous error.
- Added field
parentinsideLEnvstruct - Updated
lenv_newto also intializeparent - Updated
lenv_getto check for local and global environment for variables - Implemented
lenv_copyto copy environments - Implemented
lenv_put_globalto add variable directly to parent environment rather than local. - Typecast
lenvtovoidinbuiltin_lambda Won't compileSegfaults (hopefully) due to unimplemented builtins..
- Modified
builtin_deftobuiltin_varfor handling cases of different environment
- Updated macro comments
- Seperate cases for
LVAL_NUMandLVAL_FUNinlval_del - Fix bug in
lval_copy - Implement
lval_call - Invoke
lval_callinstead oflbuiltininlval_eval_sexpr - Fixed whitespace
- Added/Modified comments
- Replace
lval_wrap_strwithlval_wrap_sym - Removed stupid allocation bug in
lval_copy! Code runs!
- Replaced Commit messages in this readme with updates..
- Changed
firsttolfuninlval_eval_sexprwhich I find more fitting.. - Grouped builtins in
lenv_init_builtins - Removed unnecessary level of indentation inside quotes
- Added code to handle variable number of arguments
- Fixed some comments/variables
- Realized
builtin_subis broken!
- Added some comments
- Released lispy v0.0.8!
- Added builtins for conditionals
- Added declaration of a couple of functions and descriptive comments
- Added if builtin
- Added a missing
\n - Moved some code within the file
- Released lispy v0.0.9!
- Support for strings
- Updated corresponding functions/parser syntax
- Added support functions for printing/reading strings
- Added related documentation
- Also some code movement
- Added support for comments
- Parsers are now declared in parsers.h for sharing globals
- Added support for loading files using
mpc_parse_contents - Added support for printing strings
- Added support for creating errors from strings
- Added more functions required by
prompt.ctolval.h - Added support for running files using command-line arguments
- Released lispy v0.0.10!