mwatts15 / Crono

Scheme project for CS345
0 stars 0 forks source link

Leaking definitions #23

Closed mwatts15 closed 11 years ago

mwatts15 commented 11 years ago

Definitions are being lost during interpretation:

(markw@envy)(zsh:2)(/v/filer4b/v38q001/markw/cs345/proj/crono)
(1160)% ./crono.sh -T                                                                                        23:38
Crono++ by Mark Watts, Carlo Vidal, Troy Varney (c) 2012

> (load "prelude.lisp")
Visiting (load prelude.lisp)
  Visiting load
    Result: load
  Visiting prelude.lisp
    Result: prelude.lisp
  Result: #t
Result: #t
> (prFoldr + 1 '(1 2 3))
Visiting (prFoldr + 1 '(1 2 3))
  Visiting prFoldr
    Result: (\ (fn z x) (<Y> (<B> (<COND> (= Nil) (<K> z)) (<B> (<S> (<B> fn (car))) (<C> <B> cdr))) x))
  Visiting +
    Result: +
  Visiting 1
    Result: 1
  Visiting '(1 2 3)
  Visiting (1 2 3)
    Result: (1 2 3)
    Result: (1 2 3)
Invalid Function Application: g is not a function in (g x)
vvvvvvvvvHEREvvvvvvvvvv
> (prFoldr + 1 '(1 2 3))
Invalid Function Application: prFoldr is not a function in (prFoldr + 1 '(1 2 3))
^^^^^^^^^^^^^^^^^^^^^^^^^
> 

and even more disturbing

> (+ 2 3)
Result: (+ 2 3)
> (+ 2 3 4)
Too many arguments to +: 3/2 recieved
> (+ 2 3)
Result: (+ 2 3)
>

First guess is unmatched push/popEnv()

mwatts15 commented 11 years ago

Tracing environment pushes and pops doesn't reveal anything.

tvarney commented 11 years ago

It's probably because the interpreter doesn't reset any modified options when throwing an exception. EvalType is the offender in this case.

tvarney commented 11 years ago

Yep, adding a line to set the eval variable back to it's saved value fixed this. Closing.