-
Notifications
You must be signed in to change notification settings - Fork 0
Grammar Syntax
Frizzante's grammar syntax is deliberately kept simple so that most constructs are passed directly into the output without modification. This allows Frizzante to generate valid strings for a wide variety of languages or protocols.
Comments in Frizzante are preceded by a #
and can appear outside of rule definitions:
rule1:
This is rule #1
;
# This is a Frizzante comment
rule2:
....
Comments inside a rule definition are not handled by Frizzante, so you can put, for example, /* .. */
-style comments in your Java grammar and they will be passed into the output.
The following options modify the way Frizzante parses the grammar file. They should be placed on individual lines at the top of the grammar file.
#option STANDALONE_SEMICOLONS
When generating code in languages where the semicolon is a statement separator, this option will force Frizzante to consider only semicolons that are on their own line as grammar rule terminators. All other semicolons will be passed verbatim into the output.
#option TRAILING_PIPES
With this option, Frizzante will only consider pipe characters (|
) that are at the end of the line to be grammar production separators. All other pipe characters will be passed verbatim into the output. This way you can generate most strings that contain pipes.
#option SKIP_WHITESPACE
By default, whitespace from the grammar file is preserved as much as possible into the output. With this option, all whitespace will be discarded and Frizzante will produce strings with no spaces whatsoever. This is useful when generating any representation of binary data, e.g. hex strings.