evaluator: add environment, make definitions work, add tests

This commit is contained in:
2018-04-30 16:48:27 +02:00
parent 584f9b24c7
commit 92a2ecbd8e
8 changed files with 36 additions and 9 deletions

View File

@@ -0,0 +1,6 @@
tests
testDefineExpression
ph parseAndEval: '(define pi 3.14)'.
self
assert: (ph parseAndEval: 'pi')
equals: 3.14

View File

@@ -0,0 +1,6 @@
tests
testEvalExpressionReassignment
ph parseAndEval: '(define pi 3.14)'.
ph parseAndEval: '(define pi2 pi)'.
ph parseAndEval: '(define pi 6.28)'.
self assert: (ph parseAndEval: 'pi2') equals: 3.14