From b85a03d829d16ce053526ff46f19e19185fad992 Mon Sep 17 00:00:00 2001
From: AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>
Date: Tue, 14 Dec 2021 17:34:28 +0000
Subject: Written up information around the language grammar

---
 report/esoteric_project_report.tex | 79 +++++++++-----------------------------
 1 file changed, 18 insertions(+), 61 deletions(-)

(limited to 'report/esoteric_project_report.tex')

diff --git a/report/esoteric_project_report.tex b/report/esoteric_project_report.tex
index 78a8528..3300a0b 100644
--- a/report/esoteric_project_report.tex
+++ b/report/esoteric_project_report.tex
@@ -129,70 +129,25 @@ At this stage, the code is converted into a form which can be executed by the CP
 
 One other method is to compile into another, existing programming language. This method is known as a source-to-source compiler. Here, instead of writing to machine code or bytecode, the compiler creates a string of valid source code for the language being targeted, based on the initial source code for the main compiler. This can then be executed using other, pre-existing compilers. One common use of these compilers is for web browsers, where many languages compile to javascript.
 
-\chapter{Grammar}
+\chapter{Our Esoteric Language}
+\section{EsotericFortran}
+For our esoteric language we decided to adapt an existing language into a modern form. Specifically, we chose the language Fortran. We chose Fortran as contained all the the features we were interested in implementing, but was also different enough from most currently popular languages.
 
+Of course, we have decided to make some changes from Fortran. Most importantly, we decided to include keywords in our language unlike Fortran, as we thought that allowing variables to share names with keywords adds unnecessary confusion. We have also decided to make other, small changes from Fortran, either due to time constraints or to simplify to a more modern form.
+\section{Language Grammar}
+Before we can begin implementation, we need to design the grammar of our language. The grammar not only gives us and understanding of how our language will work and allow us to spot and issues, but also our chosen parser, a recursive descent parser, heavily relies on the language grammar for its implementation.
 
-\section{Introduction to Language Grammar}
-\begin{verbatim}
-
-Work in progress currently
-
-\end{verbatim}
-Context free grammars – something = something else 
-
-Context free because there is no rule or context about where this grammar belongs, only where it goes
-
-Rewrite rules:
-S $\rightarrow$ DET N
-Were first invented by Panini %Pāṇini
- who worked on Sanscrit grammar rules
- 
-Port Royal Grammer by Antoine Arnauld and Claude Lancelot in 1660 who worked at Port-Royal-des-Champs
-
-then Ferdinand de Saussure (19th century)
+To define the language we are using formal grammars. Formal grammars are a way represent the language as a set of rules. In order to fully represent the language we are implementing we have a context-free grammar, a type 2 grammar on the Chomsky hierarchy. Context-free grammars are a type of formal grammar in the form
+T $\rightarrow$ t
+where A is a nonterminal, and t a series of terminals and nonterminals. Nonterminals are references to other rules in the language, and a terminal is an end point in the language. They are context-free as they do not look at the context of the nonterminal. 
 
-then Chomsky with Chomsky hierarchy.
-
-
-BNF form (Backus Naur form)  is a meta language for grammars
-Named after the people who invented it simultaneously 
-example:
-\begin{verbatim}<program> ::= <sequence>? 
+In order to define the language in a readable way, we have used a slightly adjusted from of the Backus-Naur form (BNF).
+\begin{verbatim}<program> ::= <statement>* 
 \end{verbatim}
-This means a program consists of a sequence of allowable grammars followed by question mark
-Can be read as “program consists of a sequence of things followed by question mark”
-
-
-Grammar consists of a series of rewrite rules
-Grammar is a quadruple. It is a set of:
-\begin{itemize}
-	\item Terminal symbols
-	\item Non terminal symbols
-	\item Set of rules
-	\item Start symbol (one of the non-terminal symbols)	
-\end{itemize}
-
-
-Any regular grammar can be recognised by regular expressions (refer to regular grammar in Chomksy hierarchy)
-
-After Chomsky came Backus and Naur – BNF 
-
-Niklaus Wirth – Pascal language
-
-Dijkstra – programming without goto (gotoless programming)
-
-
-\section {Why we chose FORTRAN}
-
-asdf
-
-\clearpage
-\chapter{BNF form}
-
-\cite{davie1982recursive} talk about bnf form here
-
-
-\begin{table}[h!]
+This example means that a program is defined as some number of statements. Here, we have used the '*' symbol to mean one or more and surrounded nonterminals with '<' and '>'. For terminals we have decided to surround any terminals with '"', such as for keywords or defining identifiers or numbers. If a nontermial has multiple possible rules we have seperated them using '|', meaning "or". 
+\newpage
+\subsection{Statements Grammar}
+\begin{table}[!htb]
 	\begin{center}
 		\begin{tabular}{|l|r|}
 			\hline
@@ -248,7 +203,9 @@ asdf
 	\caption{Grammar table for EsotericFortran Statements}
 \end{center}
 \end{table}
-\begin{table}[h!]
+\newpage
+\subsection{Expression Grammar}
+\begin{table}[!htb]
 	\begin{center}
 		\begin{tabular}{|l|r|}
 			\hline
-- 
cgit v1.2.3

