The Input Grammar

This appendix contains the grammar of PXL parameter definitions. Capital words denote terminal symbols, lower case words correspond to expandable language symbols. Some of the terminal symbols correspond to keywords of the language. These are given in the following table. Note that the terminal symbols BLOCK and DISPLAY may be specified by two different keywords each, one being a shorthand notation of the other. There are four exceptions to the capitalization rules for terminal symbols, these are the keywords TRUE, FALSE, ON, and OFF.

\makebox[2cm][l]Keyword Terminal Symbol arg ARGUMENTS B BLOCK block BLOCK D DISPLAY display DISPLAY end END FALSE FALSECONST from FROM OFF OFFCONST ON ONCONST startup STARTUP step STEP stimuli STIMULI to TO TRUE TRUECONST var VARIABLES

The following list was created by simply deleting the semantic production rules of the YACC implementation of the parser. The parser generator YACC (Johnson, 1977) is a very convenient way to develop a parser for a left to right 1 symbol look ahead grammar. It makes it easy to experiment with the language and changes are possible even in very late stages of the development. Some of the following productions seem to be superflous, but this is due to the missing semantics. Anyway, the following grammar is the definitive description of the parameter definition syntax used by PXL. The start symbol is stimdef.

stimdef:        STARTUP varlist closing
                | VARIABLES varlist argdefsection STIMULI blocklist closing
        ;
varlist:        vardef
                | varlist vardef
        ;
vardef:         IDENTIFIER '=' expression
        ;
argdefsection:  ARGUMENTS argdef
        ;
argdef:         blockdef displaydef
                | displaydef blockdef
        ;
displaydef:     DISPLAY '(' namelist ')'
        ;
blockdef:       BLOCK '(' namelist ')'
        ;
namelist:       /* empty */
                | IDENTIFIER
                | namelist separator IDENTIFIER
        ;
blocklist:      block
                | blocklist block
        ;
block:          beginblock stimlist endblock
        ;
beginblock:     BLOCK '(' arglist ')' '{'
        ;
endblock:       '}'
        ;
stimlist:       stimulus
                | stimlist stimulus
        ;
stimulus:       DISPLAY '(' arglist ')'
        ;
arglist:        /* empty */
                | expression
                | arglist separator expression
        ;
separator:      ','
                | ';'
        ;
expression:     constant
                | range
        ;
constant:       numexpr
                | string
        ;
string:         STRING
        ;
range:          numrange
                | genrange
        ;
numrange:       FROM numexpr TO numexpr STEP numexpr
                | FROM numexpr TO numexpr
        ;
genrange:       '[' rangelist ']'
                | '?'
        ;
rangelist:      /* empty */
                | constlist
        ;
constlist:      constant
                | constlist separator constant
        ;
numexpr:        '(' numexpr ')'
                | numexpr '+' numexpr
                | numexpr '-' numexpr
                | numexpr '*' numexpr
                | numexpr '/' numexpr
                | '-' numexpr
                | trueconstant
                | falseconstant
                | INTEGER
                | FLOAT
        ;
trueconstant:   ONCONST
                | TRUECONST
        ;
falseconstant:  OFFCONST
                | FALSECONST
        ;
closing:        END
        ;

Back to table of contents


Author: Hans Irtel

irtel@psychologie.uni-mannheim.de