Basil

Contents:
Home
Synopsis
Config file format
Grammar file format
Symbol attributes
Getting started
Visitors
Simulator
Examples
Download

Synopsis

basil is run from the command line as follows:
basil [options] grammar-file
Options begin with the - character. The options are:
-c filename
Set the name of the configuration file. By default, the name of the configuration file is basil.cfg. If the configuration file does not exist, then the default values are used.

-v
Be verbose. Print to standard output the number of resolved states followed by the total number of states, at fixed intervals. A resolved state is a state in which the states of the shift and goto transitions are known. This output gives a status of the closure operation. When the two numbers converge the closure operation is complete.

-l
Create the log file only. Use this option if you only want to run the basil simulator, for example.

-f
Force creation of all the output files. By default, if the grammar has conflicts, then only the log file is created. Use this option if you do not mind the order in which the actions in the conflicts are attempted.

-bc
Break on the first grammar conflict. Only the log file is created. This option may be helpful when debugging a large grammar.

-b
Bypass single rules that do not have a rule-name. A single rule is rule that has one nonterminal on the right-hand side, such as:
expr -> term
To prevent a single rule from being bypassed with this option enabled, precede it with an empty rule name:
[] expr -> term
Consider this grammar:
start -> a
a -> b Z
b -> c
c -> Y
Without this option enabled, the default action for state 1 is to reduce by rule 3 and follow c:
1
-----
c -> Y. (3)

* - REDUCE 3 c
With this option enabled, the default action is to reduce by rule 3 and follow b. The single rule b -> c is bypassed:
1
-----
c -> Y. (3)

* - REDUCE 3 b
This option can also be set in the configuration file with the keyword bypass.

-nda
Do not generate default actions. This option can significantly increase the number of states. If you do not want a default action in some context, it is much better to use the sticky follow attribute (<).

-sa
Show all state rules in the log file. By default, only the kernel rules are shown.

Consider this grammar:

start -> a
a -> b > C
b ->
b -> C
Without this option enabled, the first state is:
0
-----
start ->.a

C - SHIFT 1, REDUCE 2 b

a - GOTO 2
b - GOTO 3
With this option enabled, all the rules are shown:
0
-----
start ->.a
a ->.b > C
b ->. (2)
b ->.C

C - SHIFT 1, REDUCE 2 b

a - GOTO 2
b - GOTO 3

-ss
Show the propagated shift priority in the state rules in the log file. The propagated shift priority precedes the rule.

Here is state 0 of the above grammar with this option (and -sa) enabled:

0
-----
start ->.a
a ->.b > C
> b ->. (2)
> b ->.C

C - SHIFT 1, REDUCE 2 b

a - GOTO 2
b - GOTO 3

-sf
Show the propagated shift priority and follow set in the state rules in the log file. The propagated follow set is enclosed in square brackets after the rule.

Here is state 0 of the above grammar with this option (and -sa) enabled:

0
-----
start ->.a [EOT.start<]
a ->.b > C [EOT.a]
> b ->. (2) [C.b]
> b ->.C [C.b]

C - SHIFT 1, REDUCE 2 b

a - GOTO 2
b - GOTO 3

-r
Print to standard output the first sets of all the nonterminals. No output files are created.

With the above grammar this option will produce:

a: C
b: epsilon C

-d nonterminal
Print to standard output the derivation of nonterminal with propagated shift priorities. No output files are created.

With the above grammar this option will produce for a:

a ->.b > C
> b ->. (2)
> b ->.C

-help
-h
Print to standard output the usage, the version and a brief description of the options.