Previous Contents Next

A   Abstract syntax

Responsible: Karsten Stahl, Martin Steffen, and all others



The following extended BNF-notation specifies the abstract syntax as common intermediate data represenation for the project. Modulo some naming conventions (capitalization), the Java-implementation is straightforward. Each non-terminal is represented as a separate class. Alternatives, specified by |, are subclasses of the abstract class, to which they build the alternative. The entries of the middle collum constitute the fields of the classes. The constructors of the classes are conventionally fixed by the fields of the class (up to the order of the arguments.1 The lists of the EBNF are implemented as java.lang.LinkedList. Graphical position information, relevant only for the editor and the layout group, is omitted in the EBNF.


                  SFC ::=  istep      : step
                           steps      : step list
                           transs     : transition list
                           actions    : action list
                           declist    : declaration list
                 step ::=  name       : string
                           actions    : stepaction list
           stepaction ::=  qualifier  : action_qualifier
                           a_name     : string
               action ::=  a_name     : string
                           sap        : stmt list  (* simple assignment program *)
                stmt  ::=               skip
                       |                assign
               assign ::=  var        : variable
                           val        : expr
             variable ::=  name       : string
                           type       : type
     action_qualifier ::=  Nqual                            (* may be extended *)

           transition ::=  source     : step list
                           guard      : expr
                           target     : step list

          declaration ::=  var        : variable
                           type       : type
                           val        : constval

           expr       ::=               b_expr
                       |                u_expr
                       |                constval
                       |                variable
         b_expr       ::=  left_expr  : expr
                           right_expr : expr
                           op         : operand
                           type       : type
         u_expr       ::=  sub_expr   : expr
                           op         : operand             
                           type       : type
           operand    ::=               PLUS | MINUS | TIMES | DIV  (* Operand als *)
                       |                AND | OR | NEG              (* Konstanten in expr *)
                       |                LESS | GREATER | LEQ | GEQ | EQ | NEQ
            constval  ::=               ...| -2 | -1 | 0 | 1 | ... | true | false
            type      ::=               inttype
                       |                booltype
last generated June 14, 2002 (©Public License)
Previous Contents Next