|
|||||||||
| Home >> All >> [ java_cup overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java_cup
Class Main

java.lang.Objectjava_cup.Main
- public class Main
- extends java.lang.Object
This class serves as the main driver for the JavaCup system. It accepts user options and coordinates overall control flow. The main flow of control includes the following activities:
- Parse user supplied arguments and options.
- Open output files.
- Parse the specification from standard input.
- Check for unused terminals, non-terminals, and productions.
- Build the state machine, tables, etc.
- Output the generated code.
- Close output files.
- Print a summary if requested.
- -package name
- specify package generated classes go in [default none]
- -parser name
- specify parser class name [default "parser"]
- -symbols name
- specify name for symbol constant class [default "sym"]
- -interface
- emit symbol constant interface, rather than class
- -nonterms
- put non terminals in symbol constant class
- -expect #
- number of conflicts expected/allowed [default 0]
- -compact_red
- compact tables by defaulting to most frequent reduce
- -nowarn
- don't warn about useless productions, etc.
- -nosummary
- don't print the usual summary of parse states, etc.
- -progress
- print messages to indicate progress of the system
- -time
- print time usage summary
- -dump_grammar
- produce a dump of the symbols and grammar
- -dump_states
- produce a dump of parse state machine
- -dump_tables
- produce a dump of the parse tables
- -dump
- produce a dump of all of the above
- -debug
- turn on debugging messages within JavaCup
- -nopositions
- don't generate the positions code
- -noscanner
- don't refer to java_cup.runtime.Scanner in the parser (for compatibility with old runtimes)
- -version
- print version information for JavaCUP and halt.
- Version:
- last updated: 7/3/96
| Field Summary | |
protected static parse_action_table |
action_table
Resulting parse action table. |
protected static long |
build_end
Timing data -- when did we end state and table building |
protected static long |
check_end
Timing data -- when did we end checking |
protected static long |
dump_end
Timing data -- when did we end dumping |
protected static long |
emit_end
Timing data -- when did we finish emitting code |
protected static int |
expect_conflicts
User option -- number of conflicts to expect |
protected static long |
final_time
Timing data -- when were we completely done |
protected static long |
first_end
Timing data -- when did we end first set calculation |
protected static boolean |
include_non_terms
User option -- should we include non terminal symbol numbers in the symbol constant class. |
protected static java.io.BufferedInputStream |
input_file
Input file. |
protected static boolean |
lr_values
User option -- should generator generate code for left/right values? |
protected static long |
machine_end
Timing data -- when did we end state machine construction |
protected static boolean |
no_summary
User option -- do not print a summary. |
protected static long |
nullability_end
Timing data -- when did we end nullability calculation |
protected static boolean |
opt_compact_red
User option -- do we compact tables by making most common reduce the default action |
protected static boolean |
opt_do_debug
User option -- do we run produce extra debugging messages |
protected static boolean |
opt_dump_grammar
User option -- do we produce a dump of the grammar |
protected static boolean |
opt_dump_states
User option -- do we produce a dump of the state machine |
protected static boolean |
opt_dump_tables
User option -- do we produce a dump of the parse tables |
protected static boolean |
opt_show_timing
User option -- do we show timing information as a part of the summary |
protected static long |
parse_end
Timing data -- when did we end parsing |
protected static java.io.PrintWriter |
parser_class_file
Output file for the parser class. |
protected static long |
prelim_end
Timing data -- when did we end preliminaries |
protected static boolean |
print_progress
User option -- do we print progress messages. |
protected static long |
reduce_check_end
Timing data -- when did we end checking for non-reduced productions |
protected static parse_reduce_table |
reduce_table
Resulting reduce-goto table. |
protected static lalr_state |
start_state
Start state in the overall state machine. |
protected static long |
start_time
Timing data -- when did we start |
protected static boolean |
suppress_scanner
User option -- should generator suppress references to java_cup.runtime.Scanner for compatibility with old runtimes? |
protected static boolean |
sym_interface
User option -- should symbols be put in a class or an interface? [CSA] |
protected static java.io.PrintWriter |
symbol_class_file
Output file for the symbol constant class. |
protected static long |
table_end
Timing data -- when did we end table construction |
| Constructor Summary | |
private |
Main()
Only constructor is private, so we do not allocate any instances of this class. |
| Method Summary | |
protected static void |
build_parser()
Build the (internal) parser from the previously parsed specification. |
protected static void |
check_unused()
Check for unused symbols. |
protected static void |
close_files()
Close various files used by the system. |
static void |
dump_grammar()
Produce a human readable dump of the grammar. |
static void |
dump_machine()
Produce a (semi-) human readable dump of the complete viable prefix recognition state machine. |
static void |
dump_tables()
Produce a (semi-) human readable dumps of the parse tables |
protected static void |
emit_parser()
Call the emit routines necessary to write out the generated parser. |
protected static void |
emit_summary(boolean output_produced)
Emit a long summary message to standard error (System.err) which summarizes what was found in the specification, how many states were produced, how many conflicts were found, etc. |
static void |
main(java.lang.String[] argv)
The main driver for the system. |
protected static void |
open_files()
Open various files used by the system. |
protected static void |
parse_args(java.lang.String[] argv)
Parse command line options and arguments to set various user-option flags and variables. |
protected static void |
parse_grammar_spec()
Parse the grammar specification from standard input. |
protected static java.lang.String |
plural(int val)
Helper routine to optionally return a plural or non-plural ending. |
protected static void |
show_times()
Produce the optional timing summary as part of an overall summary. |
protected static java.lang.String |
timestr(long time_val,
long total_time)
Helper routine to format a decimal based display of seconds and percentage of total time given counts of milliseconds. |
protected static void |
usage(java.lang.String message)
Print a "usage message" that described possible command line options, then exit. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
print_progress
protected static boolean print_progress
- User option -- do we print progress messages.
opt_dump_states
protected static boolean opt_dump_states
- User option -- do we produce a dump of the state machine
opt_dump_tables
protected static boolean opt_dump_tables
- User option -- do we produce a dump of the parse tables
opt_dump_grammar
protected static boolean opt_dump_grammar
- User option -- do we produce a dump of the grammar
opt_show_timing
protected static boolean opt_show_timing
- User option -- do we show timing information as a part of the summary
opt_do_debug
protected static boolean opt_do_debug
- User option -- do we run produce extra debugging messages
opt_compact_red
protected static boolean opt_compact_red
- User option -- do we compact tables by making most common reduce the
default action
include_non_terms
protected static boolean include_non_terms
- User option -- should we include non terminal symbol numbers in the
symbol constant class.
no_summary
protected static boolean no_summary
- User option -- do not print a summary.
expect_conflicts
protected static int expect_conflicts
- User option -- number of conflicts to expect
lr_values
protected static boolean lr_values
- User option -- should generator generate code for left/right values?
sym_interface
protected static boolean sym_interface
- User option -- should symbols be put in a class or an interface? [CSA]
suppress_scanner
protected static boolean suppress_scanner
- User option -- should generator suppress references to
java_cup.runtime.Scanner for compatibility with old runtimes?
start_time
protected static long start_time
- Timing data -- when did we start
prelim_end
protected static long prelim_end
- Timing data -- when did we end preliminaries
parse_end
protected static long parse_end
- Timing data -- when did we end parsing
check_end
protected static long check_end
- Timing data -- when did we end checking
dump_end
protected static long dump_end
- Timing data -- when did we end dumping
build_end
protected static long build_end
- Timing data -- when did we end state and table building
nullability_end
protected static long nullability_end
- Timing data -- when did we end nullability calculation
first_end
protected static long first_end
- Timing data -- when did we end first set calculation
machine_end
protected static long machine_end
- Timing data -- when did we end state machine construction
table_end
protected static long table_end
- Timing data -- when did we end table construction
reduce_check_end
protected static long reduce_check_end
- Timing data -- when did we end checking for non-reduced productions
emit_end
protected static long emit_end
- Timing data -- when did we finish emitting code
final_time
protected static long final_time
- Timing data -- when were we completely done
input_file
protected static java.io.BufferedInputStream input_file
- Input file. This is a buffered version of System.in.
parser_class_file
protected static java.io.PrintWriter parser_class_file
- Output file for the parser class.
symbol_class_file
protected static java.io.PrintWriter symbol_class_file
- Output file for the symbol constant class.
start_state
protected static lalr_state start_state
- Start state in the overall state machine.
action_table
protected static parse_action_table action_table
- Resulting parse action table.
reduce_table
protected static parse_reduce_table reduce_table
- Resulting reduce-goto table.
| Constructor Detail |
Main
private Main()
- Only constructor is private, so we do not allocate any instances of this
class.
| Method Detail |
main
public static void main(java.lang.String[] argv) throws internal_error, java.io.IOException, java.lang.Exception
- The main driver for the system.
usage
protected static void usage(java.lang.String message)
- Print a "usage message" that described possible command line options,
then exit.
parse_args
protected static void parse_args(java.lang.String[] argv)
- Parse command line options and arguments to set various user-option
flags and variables.
open_files
protected static void open_files()
- Open various files used by the system.
close_files
protected static void close_files()
throws java.io.IOException
- Close various files used by the system.
parse_grammar_spec
protected static void parse_grammar_spec()
throws java.lang.Exception
- Parse the grammar specification from standard input. This produces
sets of terminal, non-terminals, and productions which can be accessed
via static variables of the respective classes, as well as the setting
of various variables (mostly in the emit class) for small user supplied
items such as the code to scan with.
check_unused
protected static void check_unused()
- Check for unused symbols. Unreduced productions get checked when
tables are created.
build_parser
protected static void build_parser()
throws internal_error
- Build the (internal) parser from the previously parsed specification.
This includes:
- Computing nullability of non-terminals.
- Computing first sets of non-terminals and productions.
- Building the viable prefix recognizer machine.
- Filling in the (internal) parse tables.
- Checking for unreduced productions.
emit_parser
protected static void emit_parser()
throws internal_error
- Call the emit routines necessary to write out the generated parser.
plural
protected static java.lang.String plural(int val)
- Helper routine to optionally return a plural or non-plural ending.
emit_summary
protected static void emit_summary(boolean output_produced)
- Emit a long summary message to standard error (System.err) which
summarizes what was found in the specification, how many states were
produced, how many conflicts were found, etc. A detailed timing
summary is also produced if it was requested by the user.
show_times
protected static void show_times()
- Produce the optional timing summary as part of an overall summary.
timestr
protected static java.lang.String timestr(long time_val, long total_time)
- Helper routine to format a decimal based display of seconds and
percentage of total time given counts of milliseconds. Note: this
is broken for use with some instances of negative time (since we don't
use any negative time here, we let if be for now).
dump_grammar
public static void dump_grammar()
throws internal_error
- Produce a human readable dump of the grammar.
dump_machine
public static void dump_machine()
- Produce a (semi-) human readable dump of the complete viable prefix
recognition state machine.
dump_tables
public static void dump_tables()
- Produce a (semi-) human readable dumps of the parse tables
|
|||||||||
| Home >> All >> [ java_cup overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
java_cup.Main