PreviousUpNext

14.5.27  Parser

The standard library Parser api defines the Parser type used by the Mythryl-Yacc parser generator.

The Parser api source code is in src/app/yacc/lib/base.api.

The above information is manually maintained and may contain errors.

api {   package token
          : api {   package lr_table
                      : api {
                            Pairlist (X, Y) = EMPTY | PAIR (X , Y , Pairlist((X, Y)));
                            State  = STATE Int;
                            Terminal  = TERM Int;
                            Nonterminal  = NONTERM Int;
                            Action  = ACCEPT | ERROR | REDUCE Int | SHIFT State;
                            Table;
                            state_count : Table -> Int;
                            rule_count : Table -> Int;
                            describe_goto : Table -> State -> Pairlist((Nonterminal, State));
                            action : Table -> (State , Terminal) -> Action;
                            goto : Table -> (State , Nonterminal) -> State;
                            initial_state : Table -> State;
                            describe_actions : Table -> State -> (Pairlist((Terminal, Action)) , Action);
                            exception GOTO (State , Nonterminal);
                                make_lr_table :
                                        {actions:Rw_Vector(((Pairlist((Terminal, Action)) , Action)) ),
                                        gotos:Rw_Vector(Pairlist((Nonterminal, State)) ), initial_state:State, rule_count:Int,
                                        state_count:Int}
                                    ->
                                    Table;};;
                Token (X, Y) = TOKEN (lr_table::Terminal , ((X , Y , Y)));
                same_token : (Token((X, Y)) , Token((X, Y))) -> Bool;};;
        package stream
          : api {
                Stream X;
                streamify : (Void -> X) -> Stream(X );
                cons : (X , Stream(X )) -> Stream(X );
                get : Stream(X ) -> (X , Stream(X ));};;
    exception PARSE_ERROR;
    Source_Position;
    Result;
    Arg;
    Semantic_Value;
    make_lexer : (Int -> String) -> stream::Stream(token::Token((Semantic_Value, Source_Position)) );
        parse :
            (   Int , stream::Stream(token::Token((Semantic_Value, Source_Position)) ) ,
                ((String , Source_Position , Source_Position) -> Void) , Arg
            )
            ->
            (Result , stream::Stream(token::Token((Semantic_Value, Source_Position)) ));
        same_token :
            (token::Token((Semantic_Value, Source_Position)) , token::Token((Semantic_Value, Source_Position)))
            ->
            Bool;};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext