1
0
forked from GitHub/gf-core

new constructs in gfcc, removed lambda

This commit is contained in:
aarne
2006-09-29 10:55:36 +00:00
parent f705205b52
commit b39ecf4c32
12 changed files with 550 additions and 399 deletions

View File

@@ -4,7 +4,7 @@ module GF.Canon.GFCC.PrintGFCC where
-- pretty-printer generated by the BNF converter
import GF.Canon.GFCC.AbsGFCC
import Data.Char
import Char
-- the top-level printing method
printTree :: Print a => a -> String
@@ -112,6 +112,7 @@ instance Print Concrete where
instance Print AbsDef where
prt i e = case e of
Fun cid type' exp -> prPrec i 0 (concatD [prt 0 cid , doc (showString ":") , prt 0 type' , doc (showString "=") , prt 0 exp])
AFl cid str -> prPrec i 0 (concatD [doc (showString "%") , prt 0 cid , doc (showString "=") , prt 0 str])
prtList es = case es of
[] -> (concatD [])
@@ -120,6 +121,7 @@ instance Print AbsDef where
instance Print CncDef where
prt i e = case e of
Lin cid term -> prPrec i 0 (concatD [prt 0 cid , doc (showString "=") , prt 0 term])
CFl cid str -> prPrec i 0 (concatD [doc (showString "%") , prt 0 cid , doc (showString "=") , prt 0 str])
prtList es = case es of
[] -> (concatD [])
@@ -143,6 +145,8 @@ instance Print Atom where
AC cid -> prPrec i 0 (concatD [prt 0 cid])
AS str -> prPrec i 0 (concatD [prt 0 str])
AI n -> prPrec i 0 (concatD [prt 0 n])
AF d -> prPrec i 0 (concatD [prt 0 d])
AM -> prPrec i 0 (concatD [doc (showString "?")])
instance Print Term where
@@ -154,10 +158,9 @@ instance Print Term where
V n -> prPrec i 0 (concatD [doc (showString "$") , prt 0 n])
C n -> prPrec i 0 (concatD [prt 0 n])
F cid -> prPrec i 0 (concatD [prt 0 cid])
L cid -> prPrec i 0 (concatD [doc (showString "$") , prt 0 cid])
A cid term -> prPrec i 0 (concatD [doc (showString "(") , prt 0 cid , doc (showString "->") , prt 0 term , doc (showString ")")])
FV terms -> prPrec i 0 (concatD [doc (showString "[|") , prt 0 terms , doc (showString "|]")])
W str term -> prPrec i 0 (concatD [doc (showString "(") , prt 0 str , doc (showString "+") , prt 0 term , doc (showString ")")])
RP term0 term -> prPrec i 0 (concatD [doc (showString "(") , prt 0 term0 , doc (showString "@") , prt 0 term , doc (showString ")")])
prtList es = case es of
[] -> (concatD [])