input:
       1
       ;
output:
       1
       ;
aliases:

       CON     = (96-122|144-171|176-181|192-199|140|172-173|189) % Hebrew letters
               ;
       VWL     = (65-72|74-77|182-187) % vowels, excluding holamdot
               ;
       TRP     = (209-225|227-239) % trope
               ;
        NUM      = (48-57)
                 ;
%% A sequence of 0 or more vowels can be terminated by another
%% consonant, a space, a non-letter, or the end of input.
       NL      = (33-64|78-81|85|91-95|123-127|139|143|188|208-225|227-239)
               ; % non-letters
       CNL     = ({CON}|{NL}) % consonant or non-letter
               ;
       SPACE   = 32
               ;
%% We need to keep track of trope that occurs above/below the
%% letter...
       UTRP    = (210-213|215-217|220-225|232-233|235-236|238-239) % upper
               ;
       LTRP    = (209|214|218-219|227-231|234|237) % lower
               ;
%% Some upper trope occurs at right edge, and some at left edge...
       RTTRP   = (221|224) % all upper right tropes
               ;
       LFTTRP  = (217|233|238) % all upper left tropes
               ;
expressions:
%% Apart from the below-named cases, the BHS text is not 100\% consistent
%% in its conventions.  Sometimes, an upper trope appears as the first
%% element of a word.
       {NL}{UTRP}{CON}{VWL}    => \1"\PutUTrpVwl{" \3 "}{" \2 "}{" \4 "}"
             ;
       {NL}{UTRP}{CON} => \1 "\PutUTrp{" \3 "}{" \2 "}"
             ;
%% Words can also be started by a space.
       {SPACE}{UTRP}{CON}{VWL} => \1"\PutUTrpVwl{" \3 "}{" \2 "}{" \4 "}"
             ;
       {SPACE}{UTRP}{CON}      => \1 "\PutUTrp{" \3 "}{" \2 "}"
             ;
%% Here are all the cases to be considered when placing the vowel place-
%% ment macros.  One case is C (consonant) followed by no vowel (V) or trope.
%% No markup is necessary for this case.
%% Next,
%%   1. C V LT|UT (LT=lower trope, UT=upper trope)
%%   2. C V
%%   3. C LT|UT V
%%   4. C LT|UT
%% This method is also efficacious because it lets us test the trope
%% separately (in the TeX macro) to see if it is a `right edge' or
%% `left edge' trope.  Remember, this information has been encoded in
%% the trope's italic correction.
       {CON}{VWL}{UTRP}        => "\PutVwlUTrp{" \1 "}{" \2 "}{" \3 "}"
                               ;
       {CON}{VWL}{LTRP}        => "\PutVwlLTrp{" \1 "}{" \2 "}{" \3 "}"
                               ;
       {CON}{VWL}      => "\PutVwl{" \1 "}{" \2 "}"
                               ;
       {CON}{UTRP}{VWL}        => "\PutUTrpVwl{" \1 "}{" \2 "}{" \3 "}"
                               ;
       {CON}{LTRP}{VWL}        => "\PutLTrpVwl{" \1 "}{" \2 "}{" \3 "}"
                               ;
       {CON}{UTRP}     => "\PutUTrp{" \1 "}{" \2 "}"
                               ;
       {CON}{LTRP}     => "\PutLTrp{" \1 "}{" \2 "}"
                               ;

%% In case of unadorned consonants, we surround them with a macro as
%% well..
       {CON}           => "\PutCon{" \1 "}"
                       ;
        {NUM}             => "\PutNum{" \1 "}"
                          ;
        .                 => "\PutOther{" \1 "}"
                          ;