Generating Software from Specifications WS 2013/14 - File parsing3Sol.fw
@=~ ~p maximum_input_line_length = infinity This file contains the specification of a language for sequences of declarations, using EBNF constructs. Try to generate a processor for it. If the parser generation indicates problems, analyse their reasons and eliminate them. The following file contains correct input for the processor: Give an example for correct input: ~O~<Declaration.ok~>~{ a,b,c : set; x,y : forward; ~} The following file specifies the concrete syntax: ~O~<Declaration.conx~>~{ Program: Declaration*. Declaration: (Ident // ',') ':' Type ';' / (Ident // ',') ':' 'forward' ';'. Type: Ident. ~} Both alternatives for Declaration begin with equivalent EBNF constructs. They are expanded using different nonterminals. It would need unbounded context to decide to which of the two Ident has to be reduced. The problem vanishes, if only one description of the sequence of Idents is used in both alternatives: ~O~<Declaration.con~>~{ Program: Declaration*. Declaration: Idents ':' Type ';' / Idents ':' 'forward' ';'. Idents: (Ident // ','). Type: Ident. ~} The following file specifies the non-literal tokens: ~O~<Declaration.gla~>~{ Ident: C_IDENTIFIER ~}
Generiert mit Camelot | Probleme mit Camelot? | Geändert am: 13.11.2013