Go to file
christian barthel 4b640bd275 function evaluation added
- `struct env` moved and `struct env` stores
  a pointer to an environment now as well.
  this is necessary to correctly evaluate
  functions at a later point in time.  consider
     (cons 1 2)
  which returns a function that binds arg1=1
  and arg2=2.  later, either arg1 or arg2
  will be accessed when doing
     (car (cons 1 2)) -> 1
     (cdr (cons 1 2)) -> 2
- debug_tval and debug_env has been added to
  show token or environments.
- add several reassure statements to verify
  the validity of the code.
- remove unnecessary 2nd environmental flag
  for eval().
  [ i thought this might be
    necessary to properly evaluate function
    calls but it turns out it's not
    necessary  ]
- add new function eval_lm().  this one
  should make the code structure cleaner
  and other custom forms have their own
  function as well.
  while there, remove debugging code as well
- remove eval_fn_name function (this one is
  actually not necessary)
- cleanup and implement eval_fn_call to
  call custom defined functions.  most of
  the former code has been removed and newly
  implemented.
  some examples that work now:

  (def cons (lm (x y) (lm (z) (if z x y))))
  (def cell (cons 1 2))
  (def cell2 (cons 3 cell))
  (cell2 t) -> 3
  (cell2 nil) -> #fn
  ((cell2 nil) t) -> 1
  (cell2 nil) nil) -> 2

  (def inc (lm (x) (add x 1)))
  (inc 1) ; -> 2
  (def inc2 (lm (x) (inc (inc x))))
  (inc2 2) -> 4

  [ more testing is still necessary ]
- BUGS section added
- small formatting updates here and there,
  whitespace removal etc.
2019-07-25 11:53:15 +02:00
Makefile makefile added 2019-06-29 13:27:46 +02:00
sample.llm comments, format, example code updated 2019-07-25 11:47:57 +02:00
tokenize.l function evaluation added 2019-07-25 11:53:15 +02:00