aboutsummaryrefslogtreecommitdiff
path: root/doc/manual
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-04-08 15:51:26 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-04-08 15:51:26 +0000
commit87bf541f23723f6a8c7f05c89984c5df0c450ec2 (patch)
tree2c6158963a8ba411d5de8323ede691530cbd0926 /doc/manual
parentb0c9baf1b5843acbb954d21bcb5cacc897236c3b (diff)
* Documented the primops.
Diffstat (limited to 'doc/manual')
-rw-r--r--doc/manual/nix-lang-ref.xml100
-rw-r--r--doc/manual/style.css5
2 files changed, 102 insertions, 3 deletions
diff --git a/doc/manual/nix-lang-ref.xml b/doc/manual/nix-lang-ref.xml
index 19917144e..5d53063ce 100644
--- a/doc/manual/nix-lang-ref.xml
+++ b/doc/manual/nix-lang-ref.xml
@@ -4,9 +4,6 @@
<sect1>
<title>Grammar</title>
- <para>
- </para>
-
<productionset>
<title>Expressions</title>
@@ -97,6 +94,8 @@
<nonterminal def="#nix.path" /> |
<nonterminal def="#nix.uri" />
<sbr />|
+ 'true' | 'false' | 'null'
+ <sbr />|
'(' <nonterminal def="#nix.expr" /> ')'
<sbr />|
'{' <nonterminal def="#nix.bind" />* '}'
@@ -180,4 +179,99 @@
</sect1>
+
+
+ <sect1>
+ <title>Semantics</title>
+
+
+
+ <sect2>
+ <title>Built-in functions</title>
+
+ <para>
+ The Nix language provides the following built-in function
+ (<quote>primops</quote>):
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><function>import</function>
+ <replaceable>e</replaceable></term>
+ <listitem>
+ <para>
+ Evaluates the expression <replaceable>e</replaceable>,
+ which must yield a path value. The Nix expression
+ stored at this path in the file system is then read,
+ parsed, and evaluated. Returns the result of the
+ evaluation of the Nix expression just read.
+ </para>
+
+ <para>
+ Example: <literal>import ./foo.nix</literal> evaluates
+ the expression stored in <filename>foo.nix</filename>
+ (in the directory containing the expression in which the
+ <function>import</function> occurs).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><function>derivation</function>
+ <replaceable>e</replaceable></term>
+ <listitem>
+ <para>
+ Evaluates the expression <replaceable>e</replaceable>,
+ which must yield an attribute set. [...]
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><function>baseNameOf</function>
+ <replaceable>e</replaceable></term>
+ <listitem>
+ <para>
+ Evaluates the expression <replaceable>e</replaceable>,
+ which must yield a string value, and returns a string
+ representing its <emphasis>base name</emphasis>. This
+ is the substring following the last path separator
+ (<literal>/</literal>).
+ </para>
+
+ <para>
+ Example: <literal>baseNameOf "/foo/bar"</literal>
+ returns <literal>"bar"</literal>, and
+ <literal>baseNameOf "/foo/bar/"</literal> returns
+ <literal>""</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><function>toString</function>
+ <replaceable>e</replaceable></term>
+ <listitem>
+ <para>
+ Evaluates the expression <replaceable>e</replaceable>
+ and coerces it into a string, if possible. Only
+ strings, paths, and URIs can be so coerced.
+ </para>
+
+ <para>
+ Example: <literal>toString
+ http://www.cs.uu.nl/</literal> returns
+ <literal>"http://www.cs.uu.nl/"</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect2>
+
+ </sect1>
+
+
</chapter> \ No newline at end of file
diff --git a/doc/manual/style.css b/doc/manual/style.css
index 5b8534533..a9b6fd2c6 100644
--- a/doc/manual/style.css
+++ b/doc/manual/style.css
@@ -218,4 +218,9 @@ div.epigraph
{
font-style: italic;
text-align: right;
+}
+
+table.productionset table.productionset
+{
+ font-family: monospace;
} \ No newline at end of file