PreviousUpNext

15.4.564  src/lib/compiler/front/parser/main/nada-parser.pkg

## nada-parser.pkg
## (C) 2001 Lucent Technologies, Bell Labs

# Compiled by:
#     src/lib/compiler/front/parser/parser.sublib

# NB: None of the 'nada' stuff is current usable or used.
#     I'm keeping it as a place-holder in case I decide
#     to support an alternate syntax like prolog or lisp.



# The Nada parser proper is implemented in
#
#     src/lib/compiler/front/parser/main/nada-parser-guts.pkg
#
# The external interface to it is implemented in
#
#     src/lib/compiler/front/parser/main/parse-nada.pkg



api Nada_Parser {

    primary_prompt:     Ref(  String );
    secondary_prompt:   Ref( String );

    #  Turn on lazy keywords and lazy declaration processing 
    #
    lazy_is_a_keyword:  Ref( Bool );            # Default FALSE.
    quotation:          Ref( Bool );            # Controls backquote quotation.   
};


stipulate
    package bc  =  basic_control;                                       # basic_control                 is from   src/lib/compiler/front/basics/main/basic-control.pkg
    package ci  =  global_control_index;                                # global_control_index          is from   src/lib/global-controls/global-control-index.pkg
    package cj  =  global_control_junk;                                 # global_control_junk                   is from   src/lib/global-controls/global-control-junk.pkg
    package ctl =  global_control;                                      # global_control                is from   src/lib/global-controls/global-control.pkg
herein

    package   nada_parser
    : (weak)  Nada_Parser
    {
        priority    =   [10, 10, 3];
        obscurity   =   3;
        prefix      =   "nada_parser";

        registry    =   ci::make { help => "parser settings" };


        # Commented out because I don't want this unused and unusable
        # stuff showing up at the user level when they list controls.
        # If this stuff goes production, this should be uncommented:
        #
    #   my _ = bc::note_subindex (prefix, registry, priority);

        convert_string = cj::cvt::string;
        convert_bool   = cj::cvt::bool;

        next_menu_slot     = REF 0;

        fun make (c, name, help, d)
            =
            {   r         =   REF d;
                menu_slot =  *next_menu_slot;

                control
                    =
                    ctl::make_control
                        {
                          name,
                          obscurity,
                          help,
                          menu_slot =>  [menu_slot],
                          control   =>  r
                      };

                next_menu_slot := menu_slot + 1;

                ci::note_control
                    #
                    registry
                    #
                    { control         =>  ctl::make_string_control c control,
                      dictionary_name =>  THE (cj::dn::to_upper "PARSER_" name)
                    };
                r;
            };


        primary_prompt
            =
            make (convert_string, "primary_prompt", "primary prompt", "-/- ");


        secondary_prompt
            =
            make (convert_string, "secondary_prompt", "secondary prompt", "=/= ");


        lazy_is_a_keyword
            =
            make (   convert_bool,
                     "lazy_is_a_keyword",
                     "whether `lazy' is considered a keyword",
                     FALSE
                 );

        quotation
            =
            make (   convert_bool,
                     "quotations",
                     "whether (anti-)quotations are recognized",
                     FALSE
                 );
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext