![]() |
Synthia
Generic and flexible data structure generator
|
Generates character strings corresponding to sentences formed according to a BNF grammar.
The simple grammar in this example, found in the file grammar.bnf, is the following:
<S> := The <adjective-group> <noun-verb> the <adjective-group> <noun> . ; <adjective-group> := <observation> <size> <age> <color> ; <noun-verb> := <nv-singular> | <nv-plural> ; <nv-singular> := <noun> <verb> ; <nv-plural> := <nouns> <verbs> ; <noun> := fox | <dog> | <cat> | bird ; <verb> := watches | plays with | runs after ; <nouns> := cats | dogs | birds | farmers ; <verbs> := play with | run after | watch ; <observation> := lovely | funny | ugly | quick | ε ; <size> := big | small | ε ; <age> := young | old | ε ; <color> := brown | black | white | grey | ε ; <dog> := poodle | pitbull | dog ; <cat> := siamese | Cheshire cat | burmese cat | cat ;
<p<blockquote>
A sample run of the program could be:
The ugly small old black cats run after the funny brown pitbull . The small young grey fox runs after the ugly old Cheshire cat . The old grey bird watches the funny brown poodle . The funny cats watch the funny old fox . …
Definition at line 63 of file GrammarDemo.java.
Static Public Member Functions | |
| static void | main (String[] args) throws InvalidGrammarException |
|
static |
Definition at line 65 of file GrammarDemo.java.