Universität Paderborn - Home Universität Paderborn
Die Universität der Informationsgesellschaft

Generating Software from Specifications WS 2013/14 - File parsing2.fw

@=~
~p maximum_input_line_length = infinity

This file contains the specification of a language
for sequences of declarations and statements. 
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 a correct input:
~O~<Expression.ok~>~{~-

~}

The following file specifies the concrete syntax:
~O~<Expression.con~>~{
Program:	Declarations Statements.
Declarations:	Declarations Declaration / Declaration.
Statements:	Statements Statement / Statement.

Declaration:	Type '(' Ident ')' ';'.
Type:		'int' / 'bool' / Ident.

Statement:	Assignment / Call.
Assignment:	VarIdent '=' Expression ';'.
VarIdent:	Ident.
Expression:	Expression '+' Operand / Operand.
Operand:	Number / VarIdent.
Call:		Ident '(' Expression ')' ';'.
~}

The following file specifies the non-literal tokens:
~O~<Expression.gla~>~{
Ident: C_IDENTIFIER
Number:     C_INTEGER
~}

Generiert mit Camelot | Probleme mit Camelot? | Geändert am: 06.11.2013