summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2021-11-15 15:48:20 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2021-11-15 15:48:20 +0000
commita82a847dba3ad2f15479e6771d9a48ca25c82df3 (patch)
tree12117368ca2628df90f517ada4656b8910628a41
parente998428ee62ec119c9e46c688f2949346990af60 (diff)
downloadesotericFORTRAN-a82a847dba3ad2f15479e6771d9a48ca25c82df3.tar.gz
esotericFORTRAN-a82a847dba3ad2f15479e6771d9a48ca25c82df3.zip
merged aiden's work with mine
-rw-r--r--report/esoteric_project_report.pdfbin229660 -> 231054 bytes
-rw-r--r--report/esoteric_project_report.tex9
2 files changed, 7 insertions, 2 deletions
diff --git a/report/esoteric_project_report.pdf b/report/esoteric_project_report.pdf
index 4139b03..6e003e6 100644
--- a/report/esoteric_project_report.pdf
+++ b/report/esoteric_project_report.pdf
Binary files differ
diff --git a/report/esoteric_project_report.tex b/report/esoteric_project_report.tex
index b8c4f93..bddb721 100644
--- a/report/esoteric_project_report.tex
+++ b/report/esoteric_project_report.tex
@@ -326,7 +326,9 @@ The long string following the sprint number is the git commit at the point in th
\section{Early sprints}
\subsection{Sprint 1 - \texttt{cb29252f1e0d29d555fb232f39d343930fc76105}}
-The first functional program version was a simple lexical analyser. At this stage no calculations were done. For example:
+The first sprint focused on developing the initial stages of the compiler. The main goal of the first sprint was to create and define the grammar for our custom esoteric language, then to create a working program to handle simple expressions through first applying lexical analysis, then using a parser. The first section of code implemented was the framework for the compiler, handing the users input and linking each section together. We decided to give the user the choice of either running the compiler with a single line of code, or running from a file containing source code, with the path given as an argument. Once completed, work on the lexical scanner could begin. The bulk of the scanner class is a function with takes the source code string as an argument, and returns an arraylist of tokens. This was done by looping through each character and assigning the correct token using a switch statement.The parser then takes this list of tokens and forms an abstract syntax tree, where each type of expression in our grammar is represented as its own class, extending a base expression class.
+
+For example:
\begin{verbatim}
Code: 3-1+2
@@ -357,7 +359,9 @@ NUMBER 3 3.0
\end{verbatim}
\subsection{Sprint 2 - \texttt{69b0ad07bac30beca1397ff187468e7597203c44}}
-This version added simple variable declaration and assignment, as well as a simple calculator. It also added reading from files. For example, running \texttt{java Interpreter.Language example2.txt} where \texttt{example2.txt} is the following:
+The goal of sprint 2 was to introduce statements to the language, starting with the simple print statement. The secondary goal was to add variable definition and assignment. Firstly text scanning was added to the lexer by first matching a alphabet character, then looking ahead until the last character. The extracted text was compared to a list of keywords, and either assigned a matching keyword, or set as an identifier. The parser was also improved, changing the return result to a list of statements. In order to more accurately check for undefined variables, an environment class was implemented, which stores any defined variables. The environment is then checked when a variable is used,which allows for more informative error messages.
+
+For example, running \texttt{java Interpreter.Language example2.txt} where \texttt{example2.txt} is the following:
\begin{verbatim}
var :: a
@@ -437,6 +441,7 @@ Undefined Variable
\end{verbatim}
\subsection{Sprint 3 - \texttt{a12094123dcacee41a7472031db6fe6027b083a7}}
+
This version added full compilation to a binary by translating to a C program and using gcc to compile it straight away. It also added strings as lists of characters, and simple if statements. For example running \texttt{java Compiler.Language example.txt} where \texttt{example.txt} is the program:
\begin{verbatim}
character (len=10)::hello