summaryrefslogtreecommitdiff
path: root/src/GF/CFGM/ParCFG.y
diff options
context:
space:
mode:
authorbringert <unknown>2005-05-17 13:04:35 +0000
committerbringert <unknown>2005-05-17 13:04:35 +0000
commit8abf80dc4d4aa9c6a783f41346e44a5012649d03 (patch)
tree6b03cbbffa6b435b57fc6f60a24f10a92ad6a3cd /src/GF/CFGM/ParCFG.y
parent31044ec728d3a9a56a660fdd32d880d13dc9ffbf (diff)
Changed CFGM format and printer to allow constants in profiles.
Diffstat (limited to 'src/GF/CFGM/ParCFG.y')
-rw-r--r--src/GF/CFGM/ParCFG.y28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/GF/CFGM/ParCFG.y b/src/GF/CFGM/ParCFG.y
index 70432ecb7..7b3041b3b 100644
--- a/src/GF/CFGM/ParCFG.y
+++ b/src/GF/CFGM/ParCFG.y
@@ -8,6 +8,7 @@ import ErrM
%name pGrammars Grammars
+-- no lexer declaration
%monad { Err } { thenM } { returnM }
%tokentype { Token }
@@ -33,10 +34,10 @@ L_err { _ }
%%
-Ident : L_ident { Ident $1 }
-Integer : L_integ { (read $1) :: Integer }
-String : L_quoted { $1 }
-SingleQuoteString : L_SingleQuoteString { SingleQuoteString ($1)}
+Ident :: { Ident } : L_ident { Ident $1 }
+Integer :: { Integer } : L_integ { (read $1) :: Integer }
+String :: { String } : L_quoted { $1 }
+SingleQuoteString :: { SingleQuoteString} : L_SingleQuoteString { SingleQuoteString ($1)}
Grammars :: { Grammars }
Grammars : ListGrammar { Grammars (reverse $1) }
@@ -61,7 +62,7 @@ ListFlag : {- empty -} { [] }
Rule :: { Rule }
-Rule : Fun ':' Profile '.' Category '->' ListSymbol { Rule $1 $3 $5 $7 }
+Rule : Fun ':' Profiles '.' Category '->' ListSymbol { Rule $1 $3 $5 $7 }
ListRule :: { [Rule] }
@@ -74,18 +75,19 @@ Fun : Ident { Cons $1 }
| '_' { Coerce }
-Profile :: { Profile }
-Profile : '[' ListInts ']' { Profile $2 }
+Profiles :: { Profiles }
+Profiles : '[' ListProfile ']' { Profiles $2 }
-Ints :: { Ints }
-Ints : '[' ListInteger ']' { Ints $2 }
+ListProfile :: { [Profile] }
+ListProfile : {- empty -} { [] }
+ | Profile { (:[]) $1 }
+ | Profile ',' ListProfile { (:) $1 $3 }
-ListInts :: { [Ints] }
-ListInts : {- empty -} { [] }
- | Ints { (:[]) $1 }
- | Ints ',' ListInts { (:) $1 $3 }
+Profile :: { Profile }
+Profile : '[' ListInteger ']' { UnifyProfile $2 }
+ | Ident { ConstProfile $1 }
ListInteger :: { [Integer] }