Skip to content

Commit

Permalink
Add stub grammar definitions and sections (#138)
Browse files Browse the repository at this point in the history
These are just empty placeholder sections with some grammar definitions
to fill in the ID expression grammars. Properly documenting this will
require going back and defining scopes and other lexical constructs.

Since all of this is more or less inherited from C/C++ I'm going to
leave them as stubs for now and focus on the HLSL-specific sections.
  • Loading branch information
llvm-beanz authored Dec 13, 2023
1 parent 7098ff0 commit 1315feb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
37 changes: 37 additions & 0 deletions specs/language/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,40 @@
and value category as \textit{E} without the enclosing parenthesis. A
parenthesized expression may be used in the same contexts with the same meaning
as the same non-parenthesized expression.

\Sub{Names}{Expr.Primary.ID}

\begin{note}
The grammar and behaviors of this section are almost identical to C/C++ with
some subtractions (notably lambdas and destructors).
\end{note}

\begin{grammar}
\define{id-expression}\br
unqualified-id\br
qualified-id
\end{grammar}

\SubSub{Unqualified Identifiers}{Expr.Primary.ID.Unqual}

\begin{grammar}
\define{unqualified-id}\br
identifier\br
operator-function-id\br
conversion-function-id\br
template-id\br
\end{grammar}

\SubSub{Qualified Identifiers}{Expr.Primary.ID.Qual}

\begin{grammar}
\define{qualified-id}\br
nested-name-specifier \opt{\keyword{template}} unqualified-id\br
\define{nested-name-specifier}\br
\terminal{::}\br
type-name \terminal{::}\br
namespace-name \terminal{::}\br
nested-name-specifier identifier \terminal{::}\br
nested-name-specifier \opt{\keyword{template}} simple-template-id \terminal{::}
\end{grammar}

13 changes: 11 additions & 2 deletions specs/language/hlsl.tex
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

\renewcommand{\familydefault}{\sfdefault}

\setcounter{secnumdepth}{3} % number subsections
\newcommand{\Ch}[2]{\chapter[#1]{#1\hfill[#2]}\label{#2}}
\newcommand{\Sec}[2]{\section[#1]{#1\hfill[#2]}\label{#2}}
\newcommand{\Sub}[2]{\subsection[#1]{#1\hfill[#2]}\label{#2}}
\newcommand{\SubSub}[2]{\subsubsection[#1]{#1\hfill[#2]}\label{#2}}

\input{glossary}

Expand Down Expand Up @@ -50,8 +52,15 @@

\setlength\parindent{0cm}

\newcounter{parcount}
\counterwithin{parcount}{subsection}
\newcommand{\newparcounter}[1]{
\newcounter{#1}
\counterwithin{#1}{chapter}
\counterwithin{#1}{section}
\counterwithin{#1}{subsection}
\counterwithin{#1}{subsubsection}
}

\newparcounter{parcount}
\newcommand\p{%
\stepcounter{parcount}%
\parnum \hspace{1em}%
Expand Down
1 change: 1 addition & 0 deletions specs/language/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
\newcommand{\define}[1]{{\textit{##1}\textnormal{:}}}
\newcommand{\terminal}[1]{{\texttt{##1}}}
\newcommand{\br}{\hfill\\*}
\newcommand{\opt}[1]{{##1\textsubscript{\textit{opt}}}}

\renewcommand{\texttt}[1]{{\small\ttfamily\upshape ##1}}

Expand Down

0 comments on commit 1315feb

Please sign in to comment.