Original Parser

version 1 by Ron Newcomb

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - Grammar Token Variables

    [More globals, but dealing at the level of individual tokens now.]

    Include (-
    Constant PATTERN_NULL = -1 ; ! $ffff; ! Entry for a token producing no text
    Constant MULTIPLE_OBJECT_PATTERN = 0;
    ! I believe $ffff would give bad results on Glulx if there were over 65K objects in a single game.

    Global found_ttype; ! Used to break up tokens into type
    Global found_tdata; ! and data (by AnalyseToken)
    Global token_filter; ! For noun filtering by user routines

    Global length_of_noun; ! Set by NounDomain to no of words in noun

    Global lookahead; ! The token after the one now being matched

    Global multi_mode; ! Multiple mode
    Global multi_wanted; ! Number of things needed in multitude
    Global multi_had; ! Number of things actually found
    Global multi_context; ! What token the multi-obj was accepted for

    Global indef_mode; ! "Indefinite" mode - ie, "take a brick"
    ! is in this mode
    Global indef_type; ! Bit-map holding types of specification
    Global indef_wanted; ! Number of items wanted (INDEF_ALL_WANTED for all)
    Constant INDEF_ALL_WANTED = 32767;
    Global indef_guess_p; ! Plural-guessing flag
    Global indef_owner; ! Object which must hold these items
    Global indef_cases; ! Possible gender and numbers of them
    Global indef_possambig; ! Has a possibly dangerous assumption
    ! been made about meaning of a descriptor?
    Global indef_nspec_at; ! Word at which a number like "two" was parsed
    ! (for backtracking)
    Global allow_plurals; ! Whether plurals presently allowed or not

    Global take_all_rule; ! Slightly different rules apply to "take all" than other uses
    ! of multiple objects, to make adjudication produce more
    ! pragmatically useful results
    ! (Not a flag: possible values 0, 1, 2)

    Global dict_flags_of_noun; ! Of the noun currently being parsed
    ! (a bitmap in #dict_par1 format)
    Global pronoun__word; ! Saved value
    Global pronoun__obj; ! Saved value

    Constant comma_word = 'comma,'; ! An "untypeable word" used to substitute
    ! for commas in parse buffers
    -) after "Utilities.i6t".


    The current token type is a token type that varies.
    The current grammar token is a grammar token that varies.
    The length of this noun is a number that varies.
    The next token is a grammar token that varies.
    The kind of multi is a grammar token that varies.
    The number of items wanted previously wanted is a number that varies.
    The number of items actually received is a number that varies.
    The indefinite article mode is a truth state that varies.
    The type of descriptor word used is a descriptor kind that varies.
    The number of items wanted is a number that varies.
    To decide what number is all items are wanted: (- INDEF_ALL_WANTED -).
    Probably plural is a truth state that varies.
    What the pronoun stands for is an object that varies.
    The grammatical case is a [bitmap] word usage that varies.
    assume leading words to be descriptors is a truth state that varies.
    Where we found a number used like an adjective is a [word position] number that varies.
    The noun filter is a rule producing a truth state that varies.
    Allow numeric words as descriptors is a truth state that varies.
    The TAKE ALL exception is a number that varies.
    The word's usages is a word usage that varies.

    The current token type variable translates into I6 as "found_ttype".
    The current grammar token variable translates into I6 as "found_tdata".
    The length of this noun variable translates into I6 as "length_of_noun".
    The next token variable translates into I6 as "lookahead".
    The kind of multi variable translates into I6 as "multi_context".
    The number of items wanted previously wanted variable translates into I6 as "multi_wanted".
    The number of items actually received variable translates into I6 as "multi_had".
    The indefinite article mode variable translates into I6 as "indef_mode".
    [Typed in A\AN\SOME]
    The type of descriptor word used variable translates into I6 as "indef_type".
    The number of items wanted variable translates into I6 as "indef_wanted".
    Probably plural variable translates into I6 as "indef_guess_p".
    What the pronoun stands for variable translates into I6 as "indef_owner".
    The grammatical case variable translates into I6 as "indef_cases".
    assume leading words to be descriptors variable translates into I6 as "indef_possambig". [rename this to imperative]
    Where we found a number used like an adjective variable translates into I6 as "indef_nspec_at".
    The noun filter variable translates into I6 as "token_filter".
    Allow numeric words as descriptors variable translates into I6 as "allow_plurals".
    The TAKE ALL exception variable translates into I6 as "take_all_rule".
    The word's usages variable translates into I6 as "dict_flags_of_noun".