From b0c9baf1b5843acbb954d21bcb5cacc897236c3b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 8 Apr 2004 13:31:57 +0000 Subject: [PATCH] * EBNF grammar for the Nix expression language. --- configure.ac | 5 + doc/manual/Makefile.am | 4 +- doc/manual/manual.xml | 10 +- doc/manual/nix-lang-ref.xml | 183 ++++++++++++++++++++++++++++++++++++ 4 files changed, 198 insertions(+), 4 deletions(-) create mode 100644 doc/manual/nix-lang-ref.xml diff --git a/configure.ac b/configure.ac index 52625b92b..1c42194c1 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,11 @@ AC_ARG_WITH(docbook-catalog, AC_HELP_STRING([--with-docbook-catalog=PATH], docbookcatalog=$withval, docbookcatalog=/docbook-dtd-missing) AC_SUBST(docbookcatalog) +AC_ARG_WITH(docbook-ebnf-catalog, AC_HELP_STRING([--with-docbook-ebnf-catalog=PATH], + [path of the DocBook XML EBNF module DTD]), + docbookebnfcatalog=$withval, docbookcatalog=/docbook-ebnf-dtd-missing) +AC_SUBST(docbookebnfcatalog) + AC_ARG_WITH(docbook-xsl, AC_HELP_STRING([--with-docbook-xsl=PATH], [path of the DocBook XSL stylesheets]), docbookxsl=$withval, docbookxsl=/docbook-xsl-missing) diff --git a/doc/manual/Makefile.am b/doc/manual/Makefile.am index 94077acc0..ef1a4d4a9 100644 --- a/doc/manual/Makefile.am +++ b/doc/manual/Makefile.am @@ -1,4 +1,4 @@ -ENV = SGML_CATALOG_FILES=$(docbookcatalog) +ENV = SGML_CATALOG_FILES=$(docbookcatalog):$(docbookebnfcatalog) XMLLINT = $(ENV) $(xmllint) $(xmlflags) --catalogs XSLTPROC = $(ENV) $(xsltproc) $(xmlflags) --catalogs \ @@ -13,7 +13,7 @@ man1_MANS = nix-env.1 nix-store.1 nix-instantiate.1 \ SOURCES = manual.xml introduction.xml installation.xml overview.xml \ $(man1_MANS:.1=.xml) \ troubleshooting.xml bugs.xml opt-common.xml opt-common-syn.xml \ - quick-start.xml style.css images + quick-start.xml nix-lang-ref.xml style.css images manual.is-valid: $(SOURCES) version.xml $(XMLLINT) --noout --valid manual.xml diff --git a/doc/manual/manual.xml b/doc/manual/manual.xml index 8188a1ff9..bd11fe0f2 100644 --- a/doc/manual/manual.xml +++ b/doc/manual/manual.xml @@ -1,8 +1,11 @@ @@ -16,6 +19,7 @@ + @@ -74,6 +78,8 @@ + &nix-lang-ref; + &troubleshooting; &bugs; diff --git a/doc/manual/nix-lang-ref.xml b/doc/manual/nix-lang-ref.xml new file mode 100644 index 000000000..19917144e --- /dev/null +++ b/doc/manual/nix-lang-ref.xml @@ -0,0 +1,183 @@ + + Nix Language Reference + + + Grammar + + + + + + Expressions + + + Expr + + + + + + + ExprFunction + + '{' '}' ':' + | + + + + + + ExprAssert + + 'assert' ';' + | + + + + + + ExprIf + + 'if' 'then' + 'else' + | + + + + + + ExprOp + + '!' + | + '==' + | + '!=' + | + '&&' + | + '||' + | + '->' + | + '//' + | + '~' + | + '?' + | + + + + + + ExprApp + + '.' + | + + + + + + ExprSelect + + + | + + + + + + ExprSimple + + | + | + | + | + + | + '(' ')' + | + '{' * '}' + | + 'let' '{' * '}' + | + 'rec' '{' * '}' + | + '[' * ']' + + + + + Bind + + '=' ';' + | + 'inherit' ('(' ')')? * ';' + + + + + Formals + + ',' + | + + + + + Formal + + + | + '?' + + + + + + + Terminals + + + Id + [a-zA-Z\_][a-zA-Z0-9\_\']* + + + + Int + [0-9]+ + + + + Str + \"[^\n\"]*\" + + + + Path + [a-zA-Z0-9\.\_\-\+]*(\/[a-zA-Z0-9\.\_\-\+]+)+ + + + + Uri + [a-zA-Z][a-zA-Z0-9\+\-\.]*\:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']+ + + + + Whitespace + + [ \t\n]+ + | + \#[^\n]* + | + \/\*(.|\n)*\*\/ + + + + + + + + \ No newline at end of file