Next: , Previous: , Up: Output Information   [Contents][Index]


Residual Regex Grammar

A residual regular expression grammar is a template regular expression grammar containing:

The parser generates a residual regular expression grammar based on a learned PCFG.

Use the following command-line format to dump a residual regular expression grammar:

$ topdown --qr[=NONT1] ... --qr[=NONTn] [--or=FILE]            \
          [--fp=fq_min_prod] [--ft=fq_min_term]                \
          [--nlp=num_lower_prod] [--nlt=num_lower_term]        \
          [--nup=num_upper_prod] [--nut=num_upper_term]        \
          [--pp=prob_min_prod] [--pt=prob_min_term]            \
          [--simplify] [--terse] REGEX_GRAM_FILE SYM_SEQ_FILE

See Learned PCFG for the description of --fp=fq_min_prod, --ft=fq_min_term, --nlp=num_lower_prod, --nlt=num_lower_term, --nup=num_upper_prod, --nut=num_upper_term, --pp=prob_min_prod, and --pt=prob_min_term options. See Iterative Determinization for the description of --simplify and --terse options.

Options specific to dumping a residual regular expression grammar are the following:

--or=FILE

Write the residual regular expression grammar to a FILE. If FILE is ‘-’, write the grammar to stdout. This option queries the residual regular expression grammar.

--qr[=NONT]

Dump productions of the residual regular expression grammar with a nonterminal symbol NONT at the left-hand side to a file specified by the option --or=FILE. You can pass multiple options --qr=NONT to dump productions for multiple nonterminal symbols. If the option --or=FILE not supplied, dump queried productions to stdout. If NONT not supplied, dump the entire residual regular expression grammar. This option queries the residual regular expression grammar.

The example of dumping a residual regular expression grammar is below. See Terminal Symbol Expansions for the content of expan.rg and expan1.seq files. See Learned PCFG for a corresponding example of dumping a learned PCFG.

$ topdown -N10 --qr --nut=2 expan.rg expan1.seq
S: A A
 | ( "a" "b" "c" "a" "b"
   | "c" "a" "b" "c" "a"
   )
;

A: "a" "b" "c"
 | "c" "a" "b"
;

Next: , Previous: , Up: Output Information   [Contents][Index]