RU beehive logo promo banner for Computing & Info Sciences
ITEC 380
2024spring
ibarland

F0-java implementation
sealed classes (w/ Java17+)

Alternate F0-java implementation

This Java implementation, F0.java, uses the same classes as F0-java/, except that it puts all the code for (say) eval into a single method, rather than spreading it across multiple classes/files. The actual-work is equivalent, but being able to stay in one file rather than separate files for 4-7 variants of Expr makes it a bit more convenient. It does this by using some more recent Java features (sealed classes, and pattern-matching-with-records), which make the result even closer to the corresponding racket F0 implementation.

You may choose to use either this F0-java-sealed/ or the traditional F0-java/ implementations. So, you ask, which should you choose as your starting point? I invite you to look at the body of eval in , and if you think you can use that example to extend it in a similar way, then go for it!

UML for implementing F0

You can invoke the JUnit tests by:

If you get a compile-time error about “class junit.framework.TestCase not found”, you'll need to make sure (a) you have JUnit .jars downloaded, and (b) your CLASSPATH includes it. See how-to-run-junit.html for further instructions.


logo for creative commons by-attribution license
This page licensed CC-BY 4.0 Ian Barland
Page last generated
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.