PreviousUpNext

15.3.30  src/app/yacc/src/grammar.api

#  (c) 1989, 1991 Andrew W. Appel, David R. Tarditi 

# Compiled by:
#     src/app/yacc/src/mythryl-yacc.lib



###             "It is never too late to be
###              what you might have been."
###
###                       -- George Eliot



api Grammar {
        
     Terminal    =    TERM  Int;
     Nonterminal = NONTERM  Int;

     Symbol  =    TERMINAL  Terminal
                 | NONTERMINAL  Nonterminal;

    # grammar:
    #   terminals should be numbered from 0 to terms-1,
    #   nonterminals should be numbered from 0 to nonterms-1,
    #   rules should be numbered between 0 and (length rules) - 1,
    #   higher precedence binds tighter,
    #   start nonterminal should not occur on the rhs of any rule


     Grammar = GRAMMAR  {
                    terms:                Int,
                    nonterms:             Int,
                    start:                Nonterminal,
                    eop:                  List( Terminal ),
                    noshift:              List( Terminal ),
                    precedence:           Terminal -> Null_Or( Int ),
                    term_to_string:         Terminal -> String,
                    nonterm_to_string:      Nonterminal -> String,
                    rules:  List { lhs:   Nonterminal, rhs:  List( Symbol ),
                             precedence:  Null_Or( Int ), rulenum:  Int }
                  }; 
};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext