|
| 1 | +\begin{alignat*}{9} |
| 2 | +&& \textit{program} &&\quad ::= &\quad && \textit{statement} \ \ldots |
| 3 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/3.1.1.html\#p6}{program}} \\[1mm] |
| 4 | +&& \textit{statement} &&\quad ::= &\quad && \textbf{\texttt{const}}\ \textit{name} \ |
| 5 | + \textbf{\texttt{=}}\ \textit{expression} \ \textbf{\texttt{;}} |
| 6 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.2.html\#p2}{constant declaration}} \\ |
| 7 | +&& && | &\quad && \textit{let} \ \textbf{\texttt{;}} |
| 8 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/3.1.1.html\#p3}{variable declaration}} \\ |
| 9 | +&& && | &\quad && \textit{assignment} \ \textbf{\texttt{;}} |
| 10 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/3.1.1.html\#p4}{variable assignment}} \\ |
| 11 | +&& && | &\quad && \textit{expression} \textbf{\texttt{[}} |
| 12 | + \textit{expression} \textbf{\texttt{]}} \ |
| 13 | + \textbf{\texttt{=}}\ \textit{expression} \ \textbf{\texttt{;}} |
| 14 | + && \textrm{array assignment} \\ |
| 15 | +&& && | &\quad && \textbf{\texttt{function}}\ \textit{name} \ |
| 16 | + \textbf{\texttt{(}}\ \textit{parameters} \ \textbf{\texttt{)}}\ \textit{block} \quad |
| 17 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.4.html\#p4}{function declaration}}\\ |
| 18 | +&& && | &\quad && \textbf{\texttt{return}}\ \textit{expression} \ \textbf{\texttt{;}} |
| 19 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.4.html\#p4}{return statement}}\\ |
| 20 | +&& && | &\quad && \textit{if-statement} \quad |
| 21 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.3.2.html\#p13}{conditional statement}}\\ |
| 22 | +&& && | &\quad && \textbf{\texttt{while}}\ |
| 23 | + \textbf{\texttt{(}}\ \textit{expression} \ \textbf{\texttt{)}} \ |
| 24 | + \textit{block} |
| 25 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/4.1.2.html\#ex_4.7}{while loop}}\\ |
| 26 | +&& && | &\quad && \textbf{\texttt{for}}\ \textbf{\texttt{(}} \ |
| 27 | + (\ \textit{\href{https://source-academy.github.io/sicp/chapters/4.1.2.html\#ex_4.8}{assignment}} \ | \ \textit{\href{https://source-academy.github.io/sicp/chapters/4.1.2.html\#ex_4.9}{let}}\ ) \textbf{\texttt{;}} \\ |
| 28 | +&& && &\quad && \ \ \ \ \ \ \ \ \ \ \textit{expression} \ \textbf{\texttt{;}} \\ |
| 29 | +&& && &\quad && \ \ \ \ \ \ \ \ \ \ \textit{assignment} \ \textbf{\texttt{)}} \ |
| 30 | + \textit{block} |
| 31 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/4.1.2.html\#ex_4.8}{for loop}}\\ |
| 32 | +&& && | &\quad && \textbf{\texttt{break}}\ \textbf{\texttt{;}} |
| 33 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/4.1.2.html\#ex_4.7}{break statement}}\\ |
| 34 | +&& && | &\quad && \textbf{\texttt{continue}}\ \textbf{\texttt{;}} |
| 35 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/4.1.2.html\#ex_4.7}{continue statement}}\\ |
| 36 | +&& && | &\quad && \textit{block} |
| 37 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.8.html\#p14}{block statement}}\\ |
| 38 | +&& && | &\quad && \textit{expression} \ \textbf{\texttt{;}} |
| 39 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.1.html\#p3}{expression statement}} \\[1mm] |
| 40 | +&& \textit{parameters} && ::= &\quad && \epsilon\ | \ \textit{name} \ |
| 41 | + (\ \textbf{\texttt{,}} \ \textit{name}\ )\ \ldots |
| 42 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.4.html\#p4}{function parameters}} \\[1mm] |
| 43 | +&& \textit{if-statement} && ::= &\quad && \textbf{\texttt{if}}\ |
| 44 | + \textbf{\texttt{(}}\ \textit{expression} \ \textbf{\texttt{)}}\ |
| 45 | + \textit{block} \\ |
| 46 | +&& && & && \textbf{\texttt{else}}\ |
| 47 | + (\ \textit{block} |
| 48 | + \ | \ |
| 49 | + \textit{\href{https://source-academy.github.io/sicp/chapters/1.3.3.html\#footnote-1}{if-statement}} \ ) |
| 50 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.3.2.html\#p12}{conditional statement}} \\[1mm] |
| 51 | +&& \textit{block} && ::= & && \textbf{\texttt{\{}}\ \textit{statement}\ \ldots \ \textbf{\texttt{\}}} \quad |
| 52 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.8.html\#p14}{block statement}} \\[1mm] |
| 53 | +&& \textit{let} && ::= &\quad && \textbf{\texttt{let}}\ \textit{name} \ |
| 54 | + \textbf{\texttt{=}}\ \textit{expression} |
| 55 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/3.1.1.html\#p3}{variable declaration}} \\[1mm] |
| 56 | +&& \textit{assignment} && ::= &\quad && \textit{name} \ |
| 57 | + \textbf{\texttt{=}}\ \textit{expression} |
| 58 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/3.1.1.html\#p4}{variable assignment}} \\[1mm] |
| 59 | +&& \textit{expression} && ::= &\quad && \textit{number} && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.1.html\#p3}{primitive number expression}}\\ |
| 60 | +&& && | &\quad && \textbf{\texttt{true}}\ |\ \textbf{\texttt{false}} |
| 61 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.6.html\#p1}{primitive boolean expression}}\\ |
| 62 | +&& && | &\quad && \textit{string} && \textrm{\href{https://source-academy.github.io/sicp/chapters/2.3.1.html}{primitive string expression}} \\ |
| 63 | +&& && | &\quad && \textbf{\texttt{null}} |
| 64 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/2.2.1.html\#p1}{primitive list expression}} \\ |
| 65 | +&& && | &\quad && \textit{name} && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.2.html}{name expression}} \\ |
| 66 | +&& && | &\quad && \textit{expression} \ \textit{binary-operator} \ |
| 67 | + \textit{expression} \qquad |
| 68 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.1.html\#p5}{binary operator combination}} \\ |
| 69 | +&& && | &\quad && \textit{unary-operator} \ |
| 70 | + \textit{expression} |
| 71 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.6.html\#p4}{unary operator combination}}\\ |
| 72 | +&& && | &\quad && \textit{expression} \ |
| 73 | + \textbf{\texttt{(}}\ \textit{expressions}\ |
| 74 | + \textbf{\texttt{)}} |
| 75 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.4.html\#p5}{function application}} \\ |
| 76 | +&& && | &\quad && (\ \textit{name}\ | \ |
| 77 | + \textbf{\texttt{(}}\ \textit{parameters}\ \textbf{\texttt{)}}\ |
| 78 | + )\ |
| 79 | + \texttt{\textbf{=>}}\ \textit{expression} |
| 80 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.3.2.html}{lambda expression (expr. body)}} \\ |
| 81 | +&& && | &\quad && (\ \textit{name}\ | \ |
| 82 | + \textbf{\texttt{(}}\ \textit{parameters}\ \textbf{\texttt{)}}\ |
| 83 | + )\ |
| 84 | + \texttt{\textbf{=>}}\ \textit{block} |
| 85 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/2.2.4.html\#footnote-3}{lambda expression (block body)}} \\ |
| 86 | +&& && | &\quad && \textit{expression} \ \textbf{\texttt{?}}\ |
| 87 | + \textit{expression} |
| 88 | + \ \textbf{\texttt{:}}\ |
| 89 | + \textit{expression}\ |
| 90 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.6.html\#p1}{conditional expression}} \\ |
| 91 | +&& && | &\quad && \textit{expression} \textbf{\texttt{[}} |
| 92 | + \textit{expression} \textbf{\texttt{]}} |
| 93 | + && \textrm{array access} \\ |
| 94 | +&& && | &\quad && \textbf{\texttt{[}}\ |
| 95 | + \textit{expressions}\ |
| 96 | + \textbf{\texttt{]}} |
| 97 | + && \textrm{literal array expression}\\ |
| 98 | +&& && | &\quad && \textbf{\texttt{(}}\ \textit{expression} \ |
| 99 | + \textbf{\texttt{)}} && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.1.html\#p6}{parenthesised expression}}\\[1mm] |
| 100 | +&& \textit{binary-operator} \ |
| 101 | + && ::= &\quad && \textbf{\texttt{+}}\ |\ \textbf{\texttt{-}}\ |\ \textbf{\texttt{*}}\ |\ \textbf{\texttt{/}}\ |\ \textbf{\texttt{\%}}\ |\ |
| 102 | + \textbf{\texttt{===}}\ |\ \textbf{\texttt{!==}}\ \\ |
| 103 | +&& && | &\quad && \texttt{\textbf{>}}\ |\ \texttt{\textbf{<}}\ |\ \texttt{\textbf{>=}}\ |\ \texttt{\textbf{<=}}\ |
| 104 | + |\ \textbf{\texttt{\&\&}}\ |\ \texttt{\textbf{||}} |
| 105 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.1.html\#p4}{binary operator}}\\[1mm] |
| 106 | +&& \textit{unary-operator} |
| 107 | + && ::= &\quad && \textbf{\texttt{!}}\ |\ \textbf{\texttt{-}} |
| 108 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.6.html\#p4}{unary operator}}\\[1mm] |
| 109 | +&& \textit{expressions} && ::= &\quad && \epsilon\ | \ \textit{expression}\ ( |
| 110 | + \ \textbf{\texttt{,}} \ |
| 111 | + \textit{expression} \ |
| 112 | + )\ \ldots |
| 113 | + && \textrm{\href{https://source-academy.github.io/sicp/chapters/1.1.4.html\#p5}{argument expressions}} |
| 114 | +\end{alignat*} |
0 commit comments