Original Parser

version 1 by Ron Newcomb

  • Home page
  • Beginning
  • Previous
  • Next

  • Chapter - Number Words

    [Not much of a parsing routine: we look through an array of pairs of number
    words (single words) and their numeric equivalents.]

    To decide which number is (x - an understood word) as digits (this is NumberWord):
        if x is listed as a spelled-out number in the language's number list:
            decide on the number as digits element.

    [ NumberWord o i n;
    n = LanguageNumbers-->0;
    for (i=1 : i<=n : i=i+2)
    if (o == LanguageNumbers-->i) return LanguageNumbers-->(i+1);
    return 0;