diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-03 10:21:30 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-03 10:21:30 +0000 |
commit | ad0976f8d5f2afbca4e2fe6cbb3d2c2e53760222 (patch) | |
tree | cc8502417b464b7284052422e5911258bd5ddcec | |
parent | 40986312bb00f0101a6634db42080daee03f887b (diff) |
* Grammar changes. Attributes in attribute sets are now delimited with
semicolons instead of comma's. Final semicolon in the set is optional.
-rw-r--r-- | src/fix-ng/fix.sdf | 57 | ||||
-rw-r--r-- | src/fix-ng/parser.cc | 3 |
2 files changed, 24 insertions, 36 deletions
diff --git a/src/fix-ng/fix.sdf b/src/fix-ng/fix.sdf index 8effe6d21..e09480314 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 7dff0363d..e159262ca 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); |