In JFLAP grammars are edited and displayed in a simple table, as shown above. Each row corresponds to a single production. The left and right columns correspond to the left and right sides of a production, naturally. To enter a rule in a particular row, select the leftmost cell of that row and type in the left hand side of the rule. Then select the rightmost column (the arrow in the middle column will appear automatically) and enter the right hand side of the rule. Lambda productions have blank right hand sides. Every symbol in the grammar is assumed to be a single character, with upper case letters as the variables, and all other characters as terminals. The left hand side of the production in the first row is always assumed to be the start variable. The table is automatically grown by one row if the last row is ever edited.
In the above picture, for example, the grammar shown has the variable set {S, A, B}, and the terminal set {a, b}. The start variable is S. There are the productions S AB, A
a, B
bB, and B
. So, the language accepted by this grammar is ab*, that is, a followed by zero or more bs.
Unlike automaton editing, the type of grammar is not defined at the time when editing begins. Rather, many of the operators applied to grammars have conditions that a grammar must satisfy. This is to say that JFLAP will notify the user of constraints upon a grammar when the user attempts to apply an operation to the grammar.