\begin{tabular}{lll}
{\reserved{bool}} &{\reserved{else}} &{\reserved{false}} \\
{\reserved{if}} &{\reserved{int}} &{\reserved{print}} \\
-{\reserved{readBool}} &{\reserved{readInt}} &{\reserved{true}} \\
-{\reserved{while}} & & \\
+{\reserved{readBool}} &{\reserved{readInt}} &{\reserved{return}} \\
+{\reserved{true}} &{\reserved{while}} & \\
\end{tabular}\\
The symbols used in syntax are the following: \\
\begin{tabular}{lll}
-{\symb{{$=$}}} &{\symb{;}} &{\symb{\{}} \\
-{\symb{\}}} &{\symb{(}} &{\symb{)}} \\
+{\symb{;}} &{\symb{\{}} &{\symb{\}}} \\
+{\symb{{$=$}}} &{\symb{(}} &{\symb{)}} \\
{\symb{{$+$}{$+$}}} &{\symb{{$-$}{$-$}}} &{\symb{{$-$}}} \\
-{\symb{{$<$}}} &{\symb{{$<$}{$=$}}} &{\symb{{$>$}}} \\
-{\symb{{$>$}{$=$}}} &{\symb{{$=$}{$=$}}} &{\symb{!{$=$}}} \\
-{\symb{{$+$}}} &{\symb{*}} &{\symb{/}} \\
+{\symb{!}} &{\symb{,}} &{\symb{{$<$}}} \\
+{\symb{{$<$}{$=$}}} &{\symb{{$>$}}} &{\symb{{$>$}{$=$}}} \\
+{\symb{{$=$}{$=$}}} &{\symb{!{$=$}}} &{\symb{{$+$}}} \\
+{\symb{*}} &{\symb{/}} & \\
\end{tabular}\\
\subsection*{Comments}
\end{tabular}\\
\begin{tabular}{lll}
-{\nonterminal{Stm}} & {\arrow} &{\nonterminal{Type}} {\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{Exp}} {\terminal{;}} \\
- & {\delimit} &{\nonterminal{Type}} {\nonterminal{Ident}} {\terminal{;}} \\
- & {\delimit} &{\nonterminal{Exp}} {\terminal{;}} \\
+{\nonterminal{Type}} & {\arrow} &{\terminal{int}} \\
+ & {\delimit} &{\terminal{bool}} \\
+\end{tabular}\\
+
+\begin{tabular}{lll}
+{\nonterminal{Program}} & {\arrow} &{\nonterminal{ListFuncStm}} \\
+\end{tabular}\\
+
+\begin{tabular}{lll}
+{\nonterminal{Stm}} & {\arrow} &{\nonterminal{Exp}} {\terminal{;}} \\
& {\delimit} &{\terminal{\{}} {\nonterminal{ListStm}} {\terminal{\}}} \\
- & {\delimit} &{\terminal{if}} {\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} {\nonterminal{Stm}} \\
- & {\delimit} &{\terminal{if}} {\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} {\nonterminal{Stm}} {\terminal{else}} {\nonterminal{Stm}} \\
+ & {\delimit} &{\nonterminal{Type}} {\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{Exp}} {\terminal{;}} \\
+ & {\delimit} &{\nonterminal{Type}} {\nonterminal{Ident}} {\terminal{;}} \\
& {\delimit} &{\terminal{while}} {\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} {\nonterminal{Stm}} \\
+ & {\delimit} &{\terminal{if}} {\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} {\nonterminal{Stm}} {\terminal{else}} {\nonterminal{Stm}} \\
+ & {\delimit} &{\terminal{if}} {\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} {\nonterminal{Stm}} \\
& {\delimit} &{\terminal{print}} {\nonterminal{Exp}} {\terminal{;}} \\
- & {\delimit} &{\nonterminal{Stm}} {\terminal{;}} \\
+ & {\delimit} &{\terminal{return}} {\nonterminal{Exp}} {\terminal{;}} \\
\end{tabular}\\
\begin{tabular}{lll}
-{\nonterminal{Exp}} & {\arrow} &{\nonterminal{Exp1}} {\nonterminal{BOp}} {\nonterminal{Exp1}} \\
+{\nonterminal{Exp}} & {\arrow} &{\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\
+ & {\delimit} &{\nonterminal{Exp1}} {\nonterminal{Op0}} {\nonterminal{Exp1}} \\
& {\delimit} &{\nonterminal{Exp1}} \\
\end{tabular}\\
{\nonterminal{Exp3}} & {\arrow} &{\nonterminal{Ident}} {\terminal{{$+$}{$+$}}} \\
& {\delimit} &{\nonterminal{Ident}} {\terminal{{$-$}{$-$}}} \\
& {\delimit} &{\nonterminal{Ident}} \\
- & {\delimit} &{\nonterminal{Ident}} {\terminal{{$=$}}} {\nonterminal{Exp}} \\
& {\delimit} &{\nonterminal{Integer}} \\
- & {\delimit} &{\terminal{{$-$}}} {\nonterminal{Exp3}} \\
& {\delimit} &{\nonterminal{Bool}} \\
+ & {\delimit} &{\terminal{{$-$}}} {\nonterminal{Exp3}} \\
+ & {\delimit} &{\terminal{!}} {\nonterminal{Exp3}} \\
& {\delimit} &{\terminal{readInt}} \\
& {\delimit} &{\terminal{readBool}} \\
+ & {\delimit} &{\nonterminal{Ident}} {\terminal{(}} {\nonterminal{ListExp}} {\terminal{)}} \\
& {\delimit} &{\terminal{(}} {\nonterminal{Exp}} {\terminal{)}} \\
\end{tabular}\\
\end{tabular}\\
\begin{tabular}{lll}
-{\nonterminal{Stms}} & {\arrow} &{\nonterminal{ListStm}} \\
+{\nonterminal{ListExp}} & {\arrow} &{\emptyP} \\
+ & {\delimit} &{\nonterminal{Exp}} \\
+ & {\delimit} &{\nonterminal{Exp}} {\terminal{,}} {\nonterminal{ListExp}} \\
\end{tabular}\\
\begin{tabular}{lll}
-{\nonterminal{BOp}} & {\arrow} &{\terminal{{$<$}}} \\
+{\nonterminal{Decl}} & {\arrow} &{\nonterminal{Type}} {\nonterminal{Ident}} \\
+\end{tabular}\\
+
+\begin{tabular}{lll}
+{\nonterminal{ListDecl}} & {\arrow} &{\emptyP} \\
+ & {\delimit} &{\nonterminal{Decl}} \\
+ & {\delimit} &{\nonterminal{Decl}} {\terminal{,}} {\nonterminal{ListDecl}} \\
+\end{tabular}\\
+
+\begin{tabular}{lll}
+{\nonterminal{Func}} & {\arrow} &{\nonterminal{Type}} {\nonterminal{Ident}} {\terminal{(}} {\nonterminal{ListDecl}} {\terminal{)}} {\terminal{\{}} {\nonterminal{ListStm}} {\terminal{\}}} \\
+\end{tabular}\\
+
+\begin{tabular}{lll}
+{\nonterminal{ListFunc}} & {\arrow} &{\emptyP} \\
+ & {\delimit} &{\nonterminal{Func}} {\nonterminal{ListFunc}} \\
+\end{tabular}\\
+
+\begin{tabular}{lll}
+{\nonterminal{FuncStm}} & {\arrow} &{\nonterminal{Stm}} \\
+ & {\delimit} &{\nonterminal{Func}} \\
+\end{tabular}\\
+
+\begin{tabular}{lll}
+{\nonterminal{ListFuncStm}} & {\arrow} &{\emptyP} \\
+ & {\delimit} &{\nonterminal{FuncStm}} {\nonterminal{ListFuncStm}} \\
+\end{tabular}\\
+
+\begin{tabular}{lll}
+{\nonterminal{Op0}} & {\arrow} &{\terminal{{$<$}}} \\
& {\delimit} &{\terminal{{$<$}{$=$}}} \\
& {\delimit} &{\terminal{{$>$}}} \\
& {\delimit} &{\terminal{{$>$}{$=$}}} \\
\begin{tabular}{lll}
{\nonterminal{Op}} & {\arrow} &{\nonterminal{Op1}} \\
& {\delimit} &{\nonterminal{Op2}} \\
-\end{tabular}\\
-
-\begin{tabular}{lll}
-{\nonterminal{Type}} & {\arrow} &{\terminal{int}} \\
- & {\delimit} &{\terminal{bool}} \\
+ & {\delimit} &{\nonterminal{Op0}} \\
\end{tabular}\\