Parsing
Index   <<   >>

 
#define AVN   (     ADV+VERB+NOUN)
#define CAVN  (CONJ+ADV+VERB+NOUN)
#define EDGE  (MARK+ASGN+LPAR)

PT cases[] = {
 EDGE,      VERB,      NOUN, ANY,       monad,   1,2, 1,
 EDGE+AVN,  VERB,      VERB, NOUN,      monad,   2,3, 2,
 EDGE+AVN,  NOUN,      VERB, NOUN,      dyad,    1,3, 2,
 EDGE+AVN,  VERB+NOUN, ADV,  ANY,       adv,     1,2, 1,
 EDGE+AVN,  VERB+NOUN, CONJ, VERB+NOUN, conj,    1,3, 1,
 EDGE+AVN,  VERB+NOUN, VERB, VERB,      trident, 1,3, 1,
 EDGE,      CAVN,      CAVN, ANY,       bident,  1,2, 1,
 NAME+NOUN, ASGN,      CAVN, ANY,       is,      0,2, 1,
 LPAR,      CAVN,      RPAR, ANY,       punc,    0,2, 0,
};

typedef struct{I c[4];AF f;I b,e,k;} PT;

/* c:  4-patterns for AT(x) of top 4 parser stack elements */
/* f:  action                                              */
/* b:  beginning index in stack that action applies to     */
/* e:  ending    index in stack that action applies to     */
/* k:            index in stack of error indicator         */