Stefan pushed to branch report/els-2017 at Stefan / Typer
Commits: ac04a418 by Stefan Monnier at 2017-01-29T20:30:46-05:00 -
- - - - -
1 changed file:
- paper.tex
Changes:
===================================== paper.tex ===================================== --- a/paper.tex +++ b/paper.tex @@ -492,9 +492,9 @@ We will first look at the middle step, and we will return to tokenizing later. \subsection{Operator precedence grammar}
Typer's notion of S-expression is more flexible than Lisp's, since it allows -infix notation. It relies on operator precedence grammars (OPG) for that. -An OPG is a very restrictive subset of context free grammars, much more -restrictive than LALR, for example. +infix notation. It relies on operator precedence grammars +(OPG)~\cite{Floyd63} for that. An OPG is a very restrictive subset of +context free grammars, much more restrictive than LALR, for example.
You can think of the job of an OPG parser as trying to add parentheses to recover the document's structure: whenever the parser sees something of the @@ -508,7 +508,7 @@ In Typer, the grammar is represented by simply associating to each keyword two precedence levels: one for its left side and another for its right side. Then parsing uses the following rule: when we see ``$\id{kw}_1~e~\id{kw}_2$'', we lookup the right precedence of $\id{kw}_1$ -and the left precedence of $\id{kw}_2$, and we then attach $e$ with +and the left precedence of $\id{kw}_2$, and we then attach $e$ to whichever is higher.
While it enjoys an efficient implementation, the motivation behind the
View it on GitLab: https://gitlab.com/monnier/typer/commit/ac04a418077ef52f8bd512e6d00d21c8fbb7...
Afficher les réponses par date