16 lines
1.9 KiB
TeX
16 lines
1.9 KiB
TeX
This report describes the programming language and implementation \emph{Boppi}. First a summary of the language is provided, listing the kind of features in the language. Next is a description of language features including examples and semantics. This is followed by a description of Java classes used to compile the language and a listing of changes to the ILOC virtual machine. Then the obstacles encountered during development and solutions to them are covered. Lastly, a description of test programs and concluding words about the project.
|
|
|
|
|
|
\section{Language overview}
|
|
As per the project description, the language description is written in \emph{ANTLR 4}, leveraging its support for direct left-recursion and far lookahead. The compiler chain is written in Java and compiles Boppi programs to the \emph{ILOC} virtual machine language. ILOC was chosen for its simple instruction set and ability to extend and inspect the virtual machine.\\
|
|
A library for dynamic allocation and for basic functions were written in ILOC.\\
|
|
|
|
Boppi includes the following features:
|
|
\begin{description}
|
|
\item[basic expressions] comprise arithmetic with integers, comparisons with integers, characters and booleans.
|
|
\item[conditionals] comprise constructions equivalent to \verb|if|, \verb|if else| and \verb|while|.
|
|
\item[variables (and constants)] names that have an explicit type and that can be assigned a value. Moreover these have a scope (between \verb|{ }| or within conditionals and functions) in which they can be used.
|
|
\item[functions] pieces of code that can be called from somewhere else. These pieces may take parameters and return a value. Functions in Boppi can be saved in variables. Moreover, variables declared within a function can outlive a call to the function, thereby creating a \emph{closure}.
|
|
\item[arrays] a sequence of values of a certain type. Arrays in Boppi are created at run-time and may have any non-void type.
|
|
\end{description}
|