mirror of
https://github.com/thufschmitt/tix-papers.git
synced 2024-09-11 13:00:34 +03:00
Remove the "syntax" package
Replace all "grammar" environments by listings. This is required as the "syntax" package seems to conflict with "markdown" which I plan to introduce.
This commit is contained in:
parent
7629226326
commit
474aa41f4c
@ -105,40 +105,40 @@ ce qui oblige le système de type à être conscient du fait que dans la branche
|
||||
condition a une forme particulière qui nécessite un traitement particulier).
|
||||
|
||||
\begin{figure}
|
||||
\def\dots{$\cdots$}
|
||||
\begin{grammar}
|
||||
\bfseries
|
||||
<expr> ::=
|
||||
<ident> | <constant>
|
||||
\alt $\lambda$ <pattern>.<expr> | <expr> <expr>
|
||||
\alt let <ident> = <expr>; \dots; <ident> = <expr>; in <expr>
|
||||
\alt [ <expr> \dots <expr> ]
|
||||
\alt \{ <record-field>; \dots; <record-field>; \}
|
||||
\alt rec \{ <record-field>; \dots; <record-field>; \}
|
||||
\alt if <expr> then <expr> else <expr>
|
||||
\alt <expr>.<acces-path>
|
||||
\alt <expr>.<acces-path> or <expr>
|
||||
\alt <expr> <infix-op> <expr>
|
||||
\begin{lstlisting}
|
||||
<expr> ::=
|
||||
<ident> | <constant>
|
||||
| $\lambda$ <pattern>.<expr> | <expr> <expr>
|
||||
| let <ident> = <expr>; $\cdots$; <ident> = <expr>; in <expr>
|
||||
| [ <expr> $\cdots$ <expr> ]
|
||||
| { <record-field>; $\cdots$; <record-field>; }
|
||||
| rec { <record-field>; $\cdots$; <record-field>; }
|
||||
| if <expr> then <expr> else <expr>
|
||||
| <expr>.<acces-path>
|
||||
| <expr>.<acces-path> or <expr>
|
||||
| <expr> <infix-op> <expr>
|
||||
|
||||
<constant> ::= <string> | <integer> | <boolean> | <paths>
|
||||
<constant> ::= <string> | <integer> | <boolean> | <paths>
|
||||
|
||||
<record-field> ::= inherit <ident> \dots <ident>
|
||||
\alt inherit (<expr>) <ident> <ident>
|
||||
\alt <ident> = <expr> | \$\{ <expr> \} = <expr>
|
||||
<record-field> ::= inherit <ident> $\cdots$ <ident>
|
||||
| inherit (<expr>) <ident> <ident>
|
||||
| <ident> = <expr> | { <expr> } = <expr>
|
||||
|
||||
<pattern> ::= <record-pattern> | <record-pattern>@<ident> | <ident>
|
||||
<pattern> ::= <record-pattern> | <record-pattern>@<ident>
|
||||
| <ident>
|
||||
|
||||
<record-pattern> ::= \{ <record-pattern-field>, \dots, <record-pattern-field> \}
|
||||
\alt \{ <record-pattern-field>, \dots, <record-pattern-field>, \ldots \}
|
||||
<record-pattern> ::=
|
||||
| { <record-pattern-field>, $\cdots$, <record-pattern-field> }
|
||||
| { <record-pattern-field>, $\cdots$, <record-pattern-field>, ... }
|
||||
|
||||
<record-pattern-field> ::= <ident> | <ident>? <expr>
|
||||
<record-pattern-field> ::= <ident> | <ident>? <expr>
|
||||
|
||||
<access-path> ::= <access-path-item>. \dots . <access-path-item>
|
||||
<access-path> ::= <access-path-item>. $\cdots$ . <access-path-item>
|
||||
|
||||
<access-path-item> ::= <ident> | \$\{ <expr> \}
|
||||
<access-path-item> ::= <ident> | { <expr> }
|
||||
|
||||
<infix-op> ::= + | - | * | / | // | ++ | \dots
|
||||
\end{grammar}
|
||||
<infix-op> ::= + | - | * | / | // | ++ | $\cdots$
|
||||
\end{lstlisting}
|
||||
\caption{Syntaxe du langage Nix\label{nix::syntax}}
|
||||
\end{figure}
|
||||
|
||||
|
11
main.tex
11
main.tex
@ -31,14 +31,14 @@
|
||||
\usepackage{listings}
|
||||
\definecolor{lstbg}{rgb}{0, 0, 0.3}
|
||||
\lstdefinelanguage{NLight}{%
|
||||
morekeywords={%
|
||||
let,in,if,then,else,Cons,Nil
|
||||
},%
|
||||
morekeywords={let,in,if,then,else,Cons,Nil},
|
||||
morekeywords={[2]Int,true,false,Bool,T}, % types go here
|
||||
otherkeywords={:,=[]}, % operators go here
|
||||
otherkeywords={:,;,=,[,],\{,\},...}, % operators go here
|
||||
literate={% replace strings with symbols
|
||||
{->}{{$\to$}}{2}
|
||||
{lambda}{{$\lambda$}}{1}
|
||||
{tau}{{\ensuremath{\tau}}}{1}
|
||||
{rho}{{\ensuremath{\rho}}}{1}
|
||||
{tin}{{$\in$}}{2}
|
||||
{\&}{{$\wedge$}}{2}
|
||||
},
|
||||
@ -56,8 +56,7 @@
|
||||
basicstyle=\color{lstbg}
|
||||
}
|
||||
|
||||
\usepackage{pandocstyle_code}
|
||||
\usepackage{syntax}
|
||||
\usepackage{myunicode}
|
||||
|
||||
\newcommand{\τ}{\ensuremath{\tau}}
|
||||
\catcode`τ=13
|
||||
|
@ -2,11 +2,9 @@
|
||||
\begin{luacode}
|
||||
-- Just to use `` as code delimiters, because LaTeX alone forbids it
|
||||
function color_lstinline(s)
|
||||
s = string.gsub (s , "%b``",
|
||||
function (match)
|
||||
local listing = string.sub(match, 2, -2)
|
||||
return "\\lstinline!" .. listing .. "!"
|
||||
end)
|
||||
s = string.gsub(s, "τ", "tau")
|
||||
s = string.gsub(s, "λ", "lambda")
|
||||
s = string.gsub(s, "ρ", "rho")
|
||||
return s
|
||||
end
|
||||
\end{luacode}
|
@ -19,25 +19,22 @@ d'information de type pour savoir que `f` doit être considérée comme un
|
||||
prédicat sur les types.
|
||||
|
||||
\begin{figure}
|
||||
\begin{grammar}
|
||||
\def\tt{\ensuremath{\tilde{t}}}
|
||||
\def\RR{\ensuremath{\tilde{R}}}
|
||||
\bfseries
|
||||
\begin{lstlisting}
|
||||
<e> ::=
|
||||
<x> | <c>
|
||||
\alt <e>.<a> | <e>.<a> or <e>
|
||||
\alt $\lambda$<p>.<e> | <e> <e>
|
||||
\alt let <vr> = <e>; $\cdots{}$; <vr> = <e>; in <e>
|
||||
\alt Cons (<e>, <e>)
|
||||
\alt (<x> = <e> $\in$ <t>) ? <e> : <e>
|
||||
<x> | <c>
|
||||
| <e>.<a> | <e>.<a> or <e>
|
||||
| $\lambda$<p>.<e> | <e> <e>
|
||||
| let <vr> = <e>; $\cdots{}$; <vr> = <e>; in <e>
|
||||
| Cons (<e>, <e>)
|
||||
| (<x> = <e> $\in$ <t>) ? <e> : <e>
|
||||
|
||||
<c> ::= <s> | <i> | <b> | Nil
|
||||
|
||||
<p> ::= <rp> | <rp>@<x> | <vr>
|
||||
|
||||
<rp> ::= \{ <rpf>, $\cdots$, <rpf> \}
|
||||
| \{ <rpf>, $\cdots$, <rpf>, \ldots \}
|
||||
| <rp>:τ
|
||||
<rp> ::= <rp>:τ
|
||||
| { <rpf>, $\cdots$, <rpf> }
|
||||
| { <rpf>, $\cdots$, <rpf>, ... }
|
||||
|
||||
<rpf> ::= <vr> | <vr> ? <c>
|
||||
|
||||
@ -45,19 +42,19 @@ prédicat sur les types.
|
||||
|
||||
<t> ::= <c> | <t> $\rightarrow$ <t>
|
||||
| <t> $\vee$ <t> | <t> $\wedge$ <t> | $\lnot$ <t>
|
||||
\alt [<R>]
|
||||
\alt bool | int | string
|
||||
| [<R>]
|
||||
| bool | int | string
|
||||
|
||||
<R> ::= <t> | <R>\textsuperscript{+} | <R>* | <R>? | <R> <R>
|
||||
| <R> \texttt{|} <R>
|
||||
<r> ::= <t> | <r>+ | <r>* | <r>?
|
||||
| <r> <r> | <r> ¦ <r>
|
||||
|
||||
<τ> ::= <c> | <τ> $\rightarrow$ <τ>
|
||||
| <τ> $\vee$ <τ> | <τ> $\wedge$ <τ>
|
||||
\alt [<R>]
|
||||
\alt bool | int | string | ?
|
||||
| [<R>]
|
||||
| bool | int | string | ?
|
||||
|
||||
<\RR> ::= <τ> | <\RR>\textsuperscript{+} | <\RR>* | <\RR>? | <\RR> <\RR>
|
||||
| <\RR> \texttt{|} <\RR>
|
||||
\end{grammar}
|
||||
<ρ> ::= <τ> | <ρ>+ | <ρ>* | <ρ>?
|
||||
| <ρ> <ρ> | <ρ> ¦ <ρ>
|
||||
\end{lstlisting}
|
||||
\caption{Grammaire de Nix-light\label{nix-light::grammar}}
|
||||
\end{figure}
|
||||
|
Loading…
Reference in New Issue
Block a user