diff options
| author | aarne <unknown> | 2004-03-31 12:30:34 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-03-31 12:30:34 +0000 |
| commit | 3f9b4e7855cf4594708a9fbad194c89540d2cf1e (patch) | |
| tree | 33dcbbd6d2e6e5f6290a25f65b4b9f90253fd34b /src/GF/Grammar | |
| parent | 6719aedde34c3a4f0ccb78931968c6fe490b3282 (diff) | |
Added support for cf and ebnf formats
Diffstat (limited to 'src/GF/Grammar')
| -rw-r--r-- | src/GF/Grammar/AppPredefined.hs | 4 | ||||
| -rw-r--r-- | src/GF/Grammar/Macros.hs | 2 | ||||
| -rw-r--r-- | src/GF/Grammar/PrGrammar.hs | 9 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/GF/Grammar/AppPredefined.hs b/src/GF/Grammar/AppPredefined.hs index eceb749b0..7ff479df0 100644 --- a/src/GF/Grammar/AppPredefined.hs +++ b/src/GF/Grammar/AppPredefined.hs @@ -16,8 +16,8 @@ typPredefined :: Ident -> Err Type typPredefined c@(IC f) = case f of "Int" -> return typePType "PBool" -> return typePType ---- "PFalse" -> -- hidden ---- "PTrue" -> + "PFalse" -> return $ cnPredef "PBool" + "PTrue" -> return $ cnPredef "PBool" "dp" -> return $ mkFunType [cnPredef "Int",typeTok] typeTok "drop" -> return $ mkFunType [cnPredef "Int",typeTok] typeTok "eqInt" -> return $ mkFunType [cnPredef "Int",cnPredef "Int"] (cnPredef "PBool") diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs index 075da2a9d..b74d02fd8 100644 --- a/src/GF/Grammar/Macros.hs +++ b/src/GF/Grammar/Macros.hs @@ -290,6 +290,8 @@ eqStrIdent = (==) tupleLabel i = LIdent $ "p" ++ show i linLabel i = LIdent $ "s" ++ show i +theLinLabel = LIdent "s" + tuple2record :: [Term] -> [Assign] tuple2record ts = [assign (tupleLabel i) t | (i,t) <- zip [1..] ts] diff --git a/src/GF/Grammar/PrGrammar.hs b/src/GF/Grammar/PrGrammar.hs index aa155c966..1a3754f04 100644 --- a/src/GF/Grammar/PrGrammar.hs +++ b/src/GF/Grammar/PrGrammar.hs @@ -68,12 +68,17 @@ prContext co = unwords $ map prParenth [prt x +++ ":" +++ prt t | (x,t) <- co] instance Print A.Exp where prt = C.printTree instance Print A.Term where prt = C.printTree instance Print A.Case where prt = C.printTree -instance Print A.Atom where prt = C.printTree instance Print A.CType where prt = C.printTree instance Print A.Label where prt = C.printTree instance Print A.Module where prt = C.printTree instance Print A.Sort where prt = C.printTree +instance Print A.Atom where + prt = C.printTree + prt_ (A.AC c) = prt_ c + prt_ (A.AD c) = prt_ c + prt_ a = prt a + instance Print A.Patt where prt = C.printTree prt_ = prPatt @@ -174,7 +179,7 @@ instance Print Atom where prt (AtV i) = prt i prt (AtL s) = s prt (AtI i) = show i - prt_ (AtC f) = prQIdent_ f + prt_ (AtC (_,f)) = prt f prt_ a = prt a prQIdent :: QIdent -> String |
