1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

* Basic grammar and parser for the Fix language. We use libsglr and

friends to do the parsing.  The parse table is embedded in the Fix
  executable using bin2c, which converts an arbitrary file into a C
  character array.
This commit is contained in:
Eelco Dolstra 2003-10-29 16:05:03 +00:00
parent 4d728f6a36
commit b95a3dc45b
6 changed files with 298 additions and 7 deletions

View file

@ -1,13 +1,12 @@
#include <map>
#include <iostream>
#include "parser.hh"
#include "globals.hh"
#include "normalise.hh"
#include "shared.hh"
typedef ATerm Expr;
typedef map<ATerm, ATerm> NormalForms;
typedef map<Path, PathSet> PkgPaths;
typedef map<Path, Hash> PkgHashes;
@ -406,9 +405,7 @@ static Expr evalFile(EvalState & state, const Path & relPath)
{
Path path = searchPath(state.searchDirs, relPath);
Nest nest(lvlTalkative, format("evaluating file `%1%'") % path);
Expr e = ATreadFromNamedFile(path.c_str());
if (!e)
throw Error(format("unable to read a term from `%1%'") % path);
Expr e = parseExprFromFile(path);
return evalExpr(state, e);
}