From 1709cb30fbdecff9cb78ad65b06792f1b6cee3fa Mon Sep 17 00:00:00 2001 From: AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> Date: Sun, 5 Dec 2021 20:52:33 +0000 Subject: Updated report grammar --- report/esoteric_project_report.tex | 58 ++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 12 deletions(-) (limited to 'report/esoteric_project_report.tex') diff --git a/report/esoteric_project_report.tex b/report/esoteric_project_report.tex index 3da6800..fd144b0 100644 --- a/report/esoteric_project_report.tex +++ b/report/esoteric_project_report.tex @@ -162,25 +162,36 @@ asdf \begin{table}[h!] \begin{center} - \begin{tabular}{|l|r|} \hline \textbf{Abbreviation} & \textbf{Term}\\ \hline - $<$program$>$ ::= & $<$statement$>$* \\ + $<$program$>$ ::= & $<$function-call$>$* \\ + \hline + $<$function-call$>$ ::= & $<$main-function$> |$ \\ + & $<$function$> |$ \\ + & $<$subroutine$>$\\ + \hline + $<$main-function$>$ ::= & "program" $<$identifier$>$ $<$block$>$ "program "$<$identifier$>$\\ + \hline + $<$function$>$::=&$<$type$>$$<$identifier$>$"("$<$expression$>$","*")"$<$block$>$\\ + \hline + $<$subroutine$>$::=&$<$identifier$>$"("$<$expression$>$","*")"$<$block$>$\\ + \hline + $<$block$>$::=& $<$statement$>$* "end" $|$\\ + & $<$statement$>$* $<$return$>$ "end" $|$\\ \hline $<$statement$>$ ::= & $<$declaration$>$ $|$ \\ & $<$expr-Statement$>$ $|$\\ & $<$print-Statement$>$ $|$ \\ - & $<$if-Statement$>$ \\ - & $<$do-Statement$>$ \\ + & $<$if-Statement$>$ $|$\\ + & $<$do-Statement$>$ $|$\\ & $<$do-while-Statement$>$ \\ \hline - $<$block$>$::=& $<$statement$>$* "end"\\ - \hline $<$declaration$>$ ::= & "character (len = "$<$number$>$")::"$<$identifier$>$ $|$ \\ - & "int::"$<$identifier$>$ \\ + & "int::"$<$identifier$>$ $|$\\ & "real::"$<$identifier$>$ \\ + & $<$type$>$ "dimension("$<$expression$>$*")"::$<$identifier$>$\\ \hline $<$print-Statement$>$ ::= & "print *" (","$<$expression$>$)* \\ \hline @@ -196,14 +207,32 @@ asdf & $<$block$>$ \\ & "do"\\ \hline + $<$return$>$ ::= & "return" $<$expression$>$\\ + \hline $<$expr-statement$>$ ::= & $<$expression$>$\\ \hline + \end{tabular} + \label{tab:table1} + \caption{Grammar table for EsotericFortran Statements} +\end{center} +\end{table} +\begin{table}[h!] + \begin{center} + \begin{tabular}{|l|r|} + \hline + \textbf{Abbreviation} & \textbf{Term}\\ + \hline + \hline $<$expression$>$ ::= & $<$assignment$>$\\ \hline $<$assignment$>$ ::= & $<$identifier$>$"="$<$equality$>$$|$\\ & $<$equality$>$$|$\\ \hline - $<$equality$>$ ::= & $<$comparison$>$"=="$<$comparison$>$$|$\\ + $<$equality$>$ ::= & $<$logical$>$("=="$|$"/=")$<$logical$>$$|$\\ + & $<$logical$>$$|$\\ + \hline + $<$logical$>$ ::= & $<$comparison$>$(".and."$|$".or.")$<$comparison$>$$|$\\ + & $<$".not."$>$$<$comparison$>$$|$\\ & $<$comparison$>$$|$\\ \hline $<$comparison$>$ ::= & $<$term$>$("$>$"$|$"$<$"$|$"$>=$"$|$"$>=$")$<$term$>$$|$\\ @@ -212,12 +241,16 @@ asdf $<$term$>$ ::= & $<$factor$>$("+"$|$"-")$<$factor$>$$|$\\ & $<$factor$>$$|$\\ \hline - $<$comparison$>$ ::= & $<$primary$>$("*"$|$"/")$<$primary$>$$|$\\ + $<$factor$>$ ::= & $<$exponent$>$("*"$|$"/")$<$exponent$>$$|$\\ + & $<$exponent$>$$|$\\ + \hline + $<$exponent$>$ ::= & $<$primary$>$"**"$<$primary$>$$|$\\ & $<$primary$>$$|$\\ \hline $<$primary$>$ ::= & $<$number$>$$|$\\ & $<$identifier$>$$|$\\ - & $<$string$>$\\ + & $<$string$>$$|$\\ + & $<$identifier$>$"("$<$expression$>$","*")"\\ \hline $<$number$>$ ::= & $<$digit$>$*("."$<$digit$>$*)?\\ @@ -233,13 +266,14 @@ asdf $<$alpha$>$::=&"a"..."z"$|$"A"..."Z"\\ \hline + $<$type$>$::=&"int"$|$"real"$|$"string"\\ + \hline \end{tabular} \label{tab:table1} - \caption{Grammar table for Fortran} + \caption{Grammar table for EsotericFortran Expressions} \end{center} \end{table} - \chapter{Documentation}\label{MethLab} We decided it would be a good idea to note down and record our application stage by stage while developing our Esolang so that we may refer back to previous parts for reference. It will also help track our progress throughout the project to ensure we stay on track. -- cgit v1.2.3