Skip to content

Commit bdedd50

Browse files
martin-henzremo5000
authored andcommitted
Add Source Week 1 as an internal reference for the Avengers (#34)
* Source Week 1 is an internal reference for the Avengers * Update README
1 parent 3439fb8 commit bdedd50

File tree

3 files changed

+53
-5
lines changed

3 files changed

+53
-5
lines changed

doc/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### Naming
2+
- The official specifications for Source § X is `source_X.pdf`.
3+
- Other `.tex` files are used as imports within the specs.
4+
- `source_week_X.pdf` is an *internal reference* for the staff, to aid with discussion groups.
5+
6+
### Generating PDFs
17
Required for making the documents is a LaTeX installation.
28

39
Just try

doc/source_names_week_1.tex

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
\section*{Names}
2+
3+
Names\footnote{
4+
In
5+
\href{http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf}{
6+
ECMAScript 2016 ($7^{\textrm{th}}$ Edition)},
7+
these names are called \emph{identifiers}.
8+
} start with \verb@_@, \verb@$@ or a
9+
letter\footnote{
10+
By \emph{letter}
11+
we mean \href{http://unicode.org/reports/tr44/}{Unicode} letters (L) or letter numbers (NI).
12+
} and contain only \verb@_@, \verb@$@,
13+
letters or digits\footnote{
14+
By \emph{digit} we mean characters in the
15+
\href{http://unicode.org/reports/tr44/}{Unicode} categories
16+
Nd (including the decimal digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9), Mn, Mc and Pc.
17+
}. Reserved words\footnote{
18+
By \emph{Reserved word} we mean any of:
19+
$\textbf{\texttt{break}}$, $\textbf{\texttt{case}}$, $\textbf{\texttt{catch}}$, $\textbf{\texttt{continue}}$, $\textbf{\texttt{debugger}}$, $\textbf{\texttt{default}}$, $\textbf{\texttt{delete}}$, $\textbf{\texttt{do}}$, $\textbf{\texttt{else}}$, $\textbf{\texttt{finally}}$, $\textbf{\texttt{for}}$, $\textbf{\texttt{function}}$, $\textbf{\texttt{if}}$, $\textbf{\texttt{in}}$, $\textbf{\texttt{instanceof}}$, $\textbf{\texttt{new}}$, $\textbf{\texttt{return}}$, $\textbf{\texttt{switch}}$, $\textbf{\texttt{this}}$, $\textbf{\texttt{throw}}$, $\textbf{\texttt{try}}$, $\textbf{\texttt{typeof}}$, $\textbf{\texttt{var}}$, $\textbf{\texttt{void}}$, $\textbf{\texttt{while}}$, $\textbf{\texttt{with}}$, $\textbf{\texttt{class}}$, $\textbf{\texttt{const}}$, $\textbf{\texttt{enum}}$, $\textbf{\texttt{export}}$, $\textbf{\texttt{extends}}$, $\textbf{\texttt{import}}$, $\textbf{\texttt{super}}$, $\textbf{\texttt{implements}}$, $\textbf{\texttt{interface}}$, $\textbf{\texttt{let}}$, $\textbf{\texttt{package}}$, $\textbf{\texttt{private}}$, $\textbf{\texttt{protected}}$, $\textbf{\texttt{public}}$, $\textbf{\texttt{static}}$, $\textbf{\texttt{yield}}$, $\textbf{\texttt{null}}$, $\textbf{\texttt{true}}$, $\textbf{\texttt{false}}$.
20+
} such as keywords are not allowed as names.
21+
22+
Valid names are \verb@x@, \verb@_45@, \verb@$$@ and $\mathtt{\pi}$,
23+
but always keep in mind that programming is communicating, and therefore the familiarity of the
24+
audience with the characters used in names is an important aspect of program readability.
25+
26+
The following names can be used, in addition to names that
27+
are declared using \texttt{\textbf{const}}, \texttt{\textbf{function}} and
28+
$\texttt{\textbf{=>}}$:
29+
\begin{itemize}
30+
\item \lstinline{math_}$\textit{name}$,
31+
where $\textit{name}$ is any name specified in the
32+
JavaScript
33+
\texttt{Math} library, see\\
34+
\href{https://www.ecma-international.org/ecma-262/8.0/index.html#sec-math-object}{\color{DarkBlue}ECMAScript Specification, Section 20.2}. Examples:
35+
\begin{itemize}
36+
\item \verb#math_PI#: Refers to the mathematical constant $\pi$,
37+
\item \verb#math_sqrt#\texttt{(n)}: Returns the square root of the \emph{number} \texttt{n}.
38+
\end{itemize}
39+
\end{itemize}

doc/source_week_1.tex

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
\begin{document}
44
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5-
\docheader{2018}{Source}{\S 1}
5+
\docheader{2018}{Source}{Week 1}
66
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77

8-
\input source_intro.tex
8+
%\input source_intro.tex
99

1010
\input source_bnf.tex
1111

@@ -14,9 +14,12 @@
1414
\textbf{\texttt{=}}\ \textit{expression} \ \textbf{\texttt{;}}
1515
&& \textrm{constant declaration} \\
1616
&& && | &\quad && \textbf{\texttt{function}}\ \textit{name} \
17-
\textbf{\texttt{(}}\ \textit{parameters} \ \textbf{\texttt{)}}\\
18-
&& && & && \textbf{\texttt{\{}}\ \textbf{\texttt{return}}\ \textit{expression} \ \textbf{\texttt{\}}} \quad
17+
\textbf{\texttt{(}}\ \textit{parameters} \ \textbf{\texttt{)}}\ \textbf{\texttt{\{}}\\
18+
&& && & && \ \ \ \ \ \ \ \textbf{\texttt{return}}\ \textit{expression} \ \textbf{\texttt{;}} \\
19+
&& && & && \textbf{\texttt{\}}}
1920
&& \textrm{function declaration}\\
21+
&& && | &\quad && \textit{statement} \
22+
\textit{statement} && \textrm{statement sequence} \\
2023
&& && | &\quad && \textit{expression} \ \textbf{\texttt{;}}
2124
&& \textrm{expression statement} \\[1mm]
2225
&& \textit{parameters} && ::= &\quad && \epsilon\ | \ \textit{name} \
@@ -57,7 +60,7 @@
5760
&& \textrm{argument expressions}
5861
\end{alignat*}
5962

60-
\input source_names
63+
\input source_names_week_1
6164

6265
\input source_numbers
6366

0 commit comments

Comments
 (0)