From e46d719895a98b4ca10c6536a68f45f0cf8e8a71 Mon Sep 17 00:00:00 2001 From: regnat Date: Fri, 7 Apr 2017 11:46:39 +0200 Subject: [PATCH] grammar: update to match typing rules --- grammar/grammar.tex | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/grammar/grammar.tex b/grammar/grammar.tex index 7063105..69ba0e9 100644 --- a/grammar/grammar.tex +++ b/grammar/grammar.tex @@ -13,27 +13,25 @@ \x/ \| \c/ \alt \e/.\a/ \| \e/.\a/ or \e/ \alt \p/:\e/ \| \e/ \e/ - \alt \{ \e/ = \e/ ; $\cdots{}$; \e/ = \e/; \} + \alt \{ \e/ = \e/ \} \alt with \e/; \e/ - \alt if \e/ then \e/ else \e/ + \alt (\e/ $\bm{\in}$ \t/) ? \e/ : \e/ \alt let \x/ = \e/; $\cdots{}$; \x/ = \e/; in \e/ - \alt Cons(\e/, \e/) \| nil \alt \o/ ::= attrNames(\e/) \| listToAttrs(\e/) - \alt addAttr(\e/, \e/, \e/) \| removeAttr(\e/, \e/) - % Not as-if in nix, but simpler than the actual builtins ("//" or - % removeAttrs), and yet sufficient thanks to attrNames and listToAttrs + \alt \e/ + \e/ \| \e/ $\orthplus$ \e/ \| \e/ \textbackslash \e/ \alt deepSeq(\e/, \e/) \| seq(\e/, \e/) \alt functionArgs(\e/) % Maybe this can be typed as a function, but it is rather unlikely + \alt Cons(\e/, \e/) ::= \b/. $\cdots{}$ .\b/ ::= \$\{\e/\} \| \meta{l} ::= \meta{s} \| \meta{i} \| $\cdots{}$ - \alt typeOf + \alt nil \alt $\cdots{}$

::= \q/ \| \q/@\x/ \| \x/ @@ -46,6 +44,9 @@ \end{grammar} +The grammar for types (\t/) is given in the \texttt{type-system} document. + + \par{values} \begin{grammar}