grammar Genea1 ; parser gParse :: Geneology { Genea1 ; } function main IO ::= args::String io1::IO { production attribute isF :: IOBoolean; isF = isFile(args, io1); production attribute text :: IOString; text = readFile(args, isF.io); local attribute tree::Geneology ; tree = gParse ( text.sValue) ; return if ! isF.bValue then error ("\n\nFile \"" ++ args ++ "\" not found.\n\n") else if tree.canParse then -- print ("Successfully parsed geneology specifications.\n\n", text.io) print (tree.report, text.io) else print ("If there is a parse error, the error comes from gParse. " ++ "tree will not be created and this branch of this else " ++ "will never be evaluated.", text.io); } synthesized attribute canParse :: Boolean occurs on Geneology ; aspect production geneology g::Geneology ::= fs::Families { g.canParse = true ; }