summaryrefslogtreecommitdiff
path: root/src/Transfer/Syntax/Syntax.cf
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2005-11-25 16:36:19 +0000
committerbringert <bringert@cs.chalmers.se>2005-11-25 16:36:19 +0000
commitdbe8e61acc616b8f5ac07e8df89eb98a7997c29d (patch)
tree6e379f18986fc60f5606e023def46abdf770dca5 /src/Transfer/Syntax/Syntax.cf
parentfe2731e5f8e301b5a0169bf8b667bb6c13bae80b (diff)
Move transfer into the GF repo.
Diffstat (limited to 'src/Transfer/Syntax/Syntax.cf')
-rw-r--r--src/Transfer/Syntax/Syntax.cf109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/Transfer/Syntax/Syntax.cf b/src/Transfer/Syntax/Syntax.cf
new file mode 100644
index 000000000..5b2e9157e
--- /dev/null
+++ b/src/Transfer/Syntax/Syntax.cf
@@ -0,0 +1,109 @@
+entrypoints Module, Exp ;
+
+layout "let", "where", "of" ;
+layout stop "in" ;
+layout toplevel ;
+
+comment "--" ;
+comment "{-" "-}" ;
+
+Module. Module ::= [Import] [Decl] ;
+
+Import. Import ::= "import" Ident ;
+separator Import ";" ;
+
+DataDecl. Decl ::= "data" Ident ":" Exp "where" "{" [ConsDecl] "}" ;
+TypeDecl. Decl ::= Ident ":" Exp ;
+ValueDecl. Decl ::= Ident [Pattern] "=" Exp ;
+DeriveDecl. Decl ::= "derive" Ident Ident ;
+separator Decl ";" ;
+
+ConsDecl. ConsDecl ::= Ident ":" Exp ;
+separator ConsDecl ";" ;
+
+-- Hack: constructor applied to at least one pattern
+-- this is to separate it from variable patterns
+PConsTop. Pattern ::= Ident Pattern1 [Pattern] ;
+_. Pattern ::= Pattern1 ;
+-- Constructor pattern with parantheses
+PCons. Pattern1 ::= "(" Ident [Pattern] ")" ;
+-- Record patterns
+PRec. Pattern1 ::= "{" [FieldPattern] "}";
+-- The pattern matching the Type constant
+PType. Pattern1 ::= "Type" ;
+-- String literal patterns
+PStr. Pattern1 ::= String ;
+-- Integer literal patterns
+PInt. Pattern1 ::= Integer ;
+-- Variable patterns
+PVar. Pattern1 ::= Ident ;
+-- Wild card patterns
+PWild. Pattern1 ::= "_" ;
+
+[]. [Pattern] ::= ;
+(:). [Pattern] ::= Pattern1 [Pattern] ;
+
+FieldPattern. FieldPattern ::= Ident "=" Pattern ;
+separator FieldPattern ";" ;
+
+ELet. Exp ::= "let" "{" [LetDef] "}" "in" Exp ;
+LetDef. LetDef ::= Ident ":" Exp "=" Exp ;
+separator LetDef ";" ;
+
+ECase. Exp ::= "case" Exp "of" "{" [Case] "}" ;
+Case. Case ::= Pattern "->" Exp ;
+separator Case ";" ;
+
+EIf. Exp ::= "if" Exp "then" Exp "else" Exp ;
+
+EAbs. Exp2 ::= "\\" VarOrWild "->" Exp ;
+EPi. Exp2 ::= "(" VarOrWild ":" Exp ")" "->" Exp ;
+EPiNoVar. Exp2 ::= Exp3 "->" Exp ;
+VVar. VarOrWild ::= Ident ;
+VWild. VarOrWild ::= "_" ;
+
+EOr. Exp3 ::= Exp4 "||" Exp3 ;
+EAnd. Exp4 ::= Exp5 "&&" Exp4 ;
+
+EEq. Exp5 ::= Exp6 "==" Exp6 ;
+ENe. Exp5 ::= Exp6 "/=" Exp6 ;
+ELt. Exp5 ::= Exp6 "<" Exp6 ;
+ELe. Exp5 ::= Exp6 "<=" Exp6 ;
+EGt. Exp5 ::= Exp6 ">" Exp6 ;
+EGe. Exp5 ::= Exp6 ">=" Exp6 ;
+
+EAdd. Exp6 ::= Exp6 "+" Exp7 ;
+ESub. Exp6 ::= Exp6 "-" Exp7 ;
+
+EMul. Exp7 ::= Exp7 "*" Exp8 ;
+EDiv. Exp7 ::= Exp7 "/" Exp8 ;
+EMod. Exp7 ::= Exp7 "%" Exp8 ;
+
+EProj. Exp8 ::= Exp8 "." Ident ;
+
+ENeg. Exp9 ::= "-" Exp9 ;
+
+EApp. Exp10 ::= Exp10 Exp11 ;
+
+EEmptyRec. Exp11 ::= "{" "}" ;
+
+ERecType. Exp11 ::= "{" [FieldType] "}" ;
+FieldType. FieldType ::= Ident ":" Exp ;
+separator nonempty FieldType ";" ;
+
+ERec. Exp11 ::= "{" [FieldValue] "}" ;
+FieldValue.FieldValue ::= Ident "=" Exp ;
+separator nonempty FieldValue ";" ;
+
+EVar. Exp11 ::= Ident ;
+EType. Exp11 ::= "Type" ;
+EStr. Exp11 ::= String ;
+EInt. Exp11 ::= Integer ;
+
+coercions Exp 11 ;
+
+
+
+
+
+