Bali++ is the language that students write a compiler for in the CS212 java practicum course. The grammar will be posted here as well as some of the requirements.
All Bali++ compilers must conform to certain specifications. Bali++ compilers must implement the CS212Compiler interface and use the exceptions included below to report errors. These files are available compiled as part of the submission package included with each assignment or as individual source files:
Each of these files is part of the edu.cornell.cs.bali.compiler package, and thus this package must be imported into any file that uses one of these classes. Also, note that IllegalBaliException is an abstract class and cannot be instantiated.
The compiler also needs to be launched. The fact that the compiler must implement an interface allows easy implementation of program that will actually compile Bali++ code. We provide an example of such a program, BC.java, which can be compiled with the command javac -classpath <AMS Package.jar> BC.java.
Finally, we also provide an example of a compiler. All compilers must be called BaliCompiler and be in the default package. The example compiler uses a PrintWriter linked to a StringWriter to easily print text into a string buffer which can then be easily returned. You are free to use this method in your compiler, and this is what we do use in our solutions, however, you are not required to.