about summary refs log tree commit diff
path: root/src/fix-ng
diff options
context:
space:
mode:
Diffstat (limited to 'src/fix-ng')
-rw-r--r--src/fix-ng/fix.sdf57
-rw-r--r--src/fix-ng/parser.cc3
2 files changed, 24 insertions, 36 deletions
diff --git a/src/fix-ng/fix.sdf b/src/fix-ng/fix.sdf
index 8effe6d21d98..e09480314bc4 100644
--- a/src/fix-ng/fix.sdf
+++ b/src/fix-ng/fix.sdf
@@ -20,60 +20,45 @@ exports
   sorts Expr Bind
   context-free syntax
 
-    Id
-    -> Expr {cons("Var")}
+    Id -> Expr {cons("Var")}
 
-    Int
-    -> Expr {cons("Int")}
+    Int -> Expr {cons("Int")}
 
-    Str
-    -> Expr {cons("Str")}
+    Str -> Expr {cons("Str")}
 
-    Uri
-    -> Expr {cons("Uri")}
+    Uri -> Expr {cons("Uri")}
 
-    Path
-    -> Expr {cons("Path")}
+    Path -> Expr {cons("Path")}
 
-    "(" Expr ")"
-    -> Expr {bracket}
+    "(" Expr ")" -> Expr {bracket}
 
-    Expr Expr
-    -> Expr {cons("Call"), left}
+    Expr Expr -> Expr {cons("Call"), left}
 
-    "{" {Id ","}* "}" ":" Expr
-    -> Expr {cons("Function"), right}
+    "{" {Id ","}* "}" ":" Expr -> Expr {cons("Function"), right}
 
-    "rec" "{" {Bind ","}* "}"
-    -> Expr {cons("Rec")}
+    "rec" "{" Binds "}" -> Expr {cons("Rec")}
+    "let" "{" Binds "}" -> Expr {cons("LetRec")}
+    "{" Binds "}" -> Expr {cons("Attrs")}
 
-    "let" "{" {Bind ","}* "}"
-    -> Expr {cons("LetRec")}
+    Id "=" Expr -> Bind {cons("Bind")}
+    {Bind ";"}* -> Binds
+    Bind ";" -> BindSemi 
+    BindSemi* -> Binds
 
-    "{" {Bind ","}* "}"
-    -> Expr {cons("Attrs")}
+    "[" Expr* "]" -> Expr {cons("List")}
 
-    Id "=" Expr
-    -> Bind {cons("Bind")}
+    Expr "." Id -> Expr {cons("Select")}
 
-    "[" {Expr ","}* "]"
-    -> Expr {cons("List")}
+    "if" Expr "then" Expr "else" Expr -> Expr {cons("If")}
 
-    Expr "." Id
-    -> Expr {cons("Select")}
+    Expr "==" Expr -> Expr {cons("OpEq")}
 
-    "if" Expr "then" Expr "else" Expr
-    -> Expr {cons("If")}
-
-    Expr "==" Expr
-    -> Expr {cons("OpEq")}
-
-    Bool
-    -> Expr {cons("Bool")}
+    Bool -> Expr {cons("Bool")}
 
   context-free priorities
 
     Expr "." Id -> Expr
+  > 
   > Expr Expr -> Expr
   > "{" {Id ","}* "}" ":" Expr -> Expr
 
diff --git a/src/fix-ng/parser.cc b/src/fix-ng/parser.cc
index 7dff0363dbc5..e159262ca1cc 100644
--- a/src/fix-ng/parser.cc
+++ b/src/fix-ng/parser.cc
@@ -147,6 +147,9 @@ Expr parseExprFromFile(Path path)
     if (!imploded)
         throw Error(format("cannot implode parse tree"));
 
+    debug(format("imploded parse tree of `%1%': %2%")
+        % path % printTerm(imploded));
+
     /* Finally, clean it up. */
     Cleanup cleanup;
     cleanup.basePath = dirOf(path);