Skip to content

Latest commit

 

History

History
17 lines (10 loc) · 638 Bytes

3.md

File metadata and controls

17 lines (10 loc) · 638 Bytes

Part 3: evaluating complex expressions

You have now already made a simple language, able to evaluate nested arithmetic expressions. It is time to add the ability to use control structures.

For our language, an if statement will suffice. The if takes three arguments. The first one is the predicate p, which is always evaluated. The second or third argument is then evaluated and returned depending on the value of p.

Make it happen!

Go on, you know what to do.

mvn -Dtest=ExpressionTests test

What's next?

Go to part 4 where we add environments that'll enable us to work with variables.