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
.
Go on, you know what to do.
mvn -Dtest=ExpressionTests test
Go to part 4 where we add environments that'll enable us to work with variables.