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
eval
andcalc
functions to accept and returnLVal
's - Add some kind of error handling using enums
- Note:
LERR_BAD_OP
is 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
sexpr
functions for use withqexpr
- Added operator for
qexpr
like 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
,LEnv
along with theirtypedef
's - Forward declare function pointer
LBuiltin
- Update
LVal
struct 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
LEnv
struct - Modify
lval_wrap_err
to parse variable arguments as error string - Add
LVal
wrapper forLBuiltin
's - Add function to print type of
LVal
- Add logic to handle
LBuiltins
inlval_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_get
works- i.e the lval passed is itself a symbol instead of a value
- Updated
LASSERT
to be variadic - Added other assertions
- Added some documentation on the macros
- Breaks previous
LASSERT
's
- Fix
LASSERT_NOT_EMPTY
to check for children of child ofLVal
instead, of child itself - Update various builtins signature to pass
LEnv
's - Rename
LASSERT_*
toLASSERT_CHILD_*
for explicitness - Accidentally replaced all
a
's withlval
in comments..- Similarly with
e
andlenv
- 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 LEnv
more natural than usingA ...
- Builtins like list, head, tail, eval, etc. now also require passing an LEnv
- Passed an
LEnv
even when not required, - which led to -Wunused-parameter which was resolved adding a
void
statment
- Passed an
- Added modulo operator logic in
builtin_op
which to my suprise was missing! - Added methods to declare and intialize
builtin
's insideLEnv
's
- Update signature and definition of
lval_eval*
to acceptLEnv
for getting symbols - Also updated their documentation
- Improved error-handling in
lval_eval_sexpr
- Fixed
lval_eval
signature inbuiltin_eval
(which should have been fixed already in earlier commits...)
- Update documentation for
lval_eval
from previous commit - Made some
LEnv
related functions public for prompt.c - Created a global
LEnv
for storing session symbols in prompt.c - Updated
sym
regex - 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
LVal
struct to have additional fields related toLBuiltin
's - s/
fun
/lbuiltin
- Added wrapper function for lambda expressions
- Fixed a typo
- Added cases for
LVAL_FUN
to handle builtins and user-defined lambda expressions - Code does not compile due to
lenv_copy
not defined
- Builtin for lambda expressions
- Added builtin to
lenv_add_builtin
- Still does not compile, due to previous error.
- Added field
parent
insideLEnv
struct - Updated
lenv_new
to also intializeparent
- Updated
lenv_get
to check for local and global environment for variables - Implemented
lenv_copy
to copy environments - Implemented
lenv_put_global
to add variable directly to parent environment rather than local. - Typecast
lenv
tovoid
inbuiltin_lambda
Won't compileSegfaults (hopefully) due to unimplemented builtins..
- Modified
builtin_def
tobuiltin_var
for handling cases of different environment
- Updated macro comments
- Seperate cases for
LVAL_NUM
andLVAL_FUN
inlval_del
- Fix bug in
lval_copy
- Implement
lval_call
- Invoke
lval_call
instead oflbuiltin
inlval_eval_sexpr
- Fixed whitespace
- Added/Modified comments
- Replace
lval_wrap_str
withlval_wrap_sym
- Removed stupid allocation bug in
lval_copy
! Code runs!
- Replaced Commit messages in this readme with updates..
- Changed
first
tolfun
inlval_eval_sexpr
which 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_sub
is 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.c
tolval.h
- Added support for running files using command-line arguments
- Released lispy v0.0.10!