Skip to content

Latest commit

 

History

History
15 lines (9 loc) · 649 Bytes

4.md

File metadata and controls

15 lines (9 loc) · 649 Bytes

Part 4: working with variables

So far, our interpreted language is only able do deal with expressions one by one. In a real programming language, we need to be able to store intermediate results in variables, and then later to look them up from the environment.

We will start by implementing the Environment class Then we'll extend evaluate to handle expressions using defined variables, and the creation of new variables with the define form.

Run the tests, and get going!

mvn -Dtest=VariablesTest test

What's next?

In part 5 the environments we just implemented enable us to make lexically scoped functions.