Java Doc for Main.java in  » Parser » CUP-develop » java_cup » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Parser » CUP develop » java_cup 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java_cup.Main

Main
public class Main (Code)
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.
Options to the main program include:
-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
author:
   Frank Flannery


Field Summary
protected static  parse_action_tableaction_table
     Resulting parse action table.
protected static  longbuild_end
    
protected static  longcheck_end
    
protected static  Filedest_dir
     Output directory.
protected static  longdump_end
    
protected static  longemit_end
    
protected static  intexpect_conflicts
    
protected static  longfinal_time
    
protected static  longfirst_end
    
protected static  booleaninclude_non_terms
     User option -- should we include non terminal symbol numbers in the symbol constant class.
protected static  BufferedInputStreaminput_file
     Input file.
protected static  booleanlr_values
    
protected static  longmachine_end
    
protected static  booleanno_summary
     User option -- do not print a summary.
protected static  longnullability_end
    
protected static  booleanopt_compact_red
    
protected static  booleanopt_do_debug
    
protected static  booleanopt_dump_grammar
    
protected static  booleanopt_dump_states
    
protected static  booleanopt_dump_tables
    
protected static  booleanopt_show_timing
    
protected static  longparse_end
    
protected static  PrintWriterparser_class_file
     Output file for the parser class.
protected static  longprelim_end
    
protected static  booleanprint_progress
     User option -- do we print progress messages.
protected static  longreduce_check_end
    
protected static  parse_reduce_tablereduce_table
     Resulting reduce-goto table.
protected static  lalr_statestart_state
     Start state in the overall state machine.
protected static  longstart_time
    
protected static  booleansuppress_scanner
    
protected static  booleansym_interface
    
protected static  PrintWritersymbol_class_file
     Output file for the symbol constant class.
protected static  longtable_end
    


Method Summary
protected static  voidbuild_parser()
     Build the (internal) parser from the previously parsed specification.
protected static  voidcheck_unused()
     Check for unused symbols.
protected static  voidclose_files()
     Close various files used by the system.
public static  voiddump_grammar()
     Produce a human readable dump of the grammar.
public static  voiddump_machine()
     Produce a (semi-) human readable dump of the complete viable prefix recognition state machine.
public static  voiddump_tables()
    
protected static  voidemit_parser()
     Call the emit routines necessary to write out the generated parser.
protected static  voidemit_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.
public static  voidmain(String argv)
     The main driver for the system.
protected static  voidopen_files()
     Open various files used by the system.
protected static  voidparse_args(String argv)
     Parse command line options and arguments to set various user-option flags and variables.
protected static  voidparse_grammar_spec()
     Parse the grammar specification from standard input.
protected static  Stringplural(int val)
     Helper routine to optionally return a plural or non-plural ending.
protected static  voidshow_times()
     Produce the optional timing summary as part of an overall summary.
protected static  Stringtimestr(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  voidusage(String message)
     Print a "usage message" that described possible command line options, then exit.

Field Detail
action_table
protected static parse_action_table action_table(Code)
Resulting parse action table.



build_end
protected static long build_end(Code)
Timing data -- when did we end state and table building



check_end
protected static long check_end(Code)
Timing data -- when did we end checking



dest_dir
protected static File dest_dir(Code)
Output directory.



dump_end
protected static long dump_end(Code)
Timing data -- when did we end dumping



emit_end
protected static long emit_end(Code)
Timing data -- when did we finish emitting code



expect_conflicts
protected static int expect_conflicts(Code)
User option -- number of conflicts to expect



final_time
protected static long final_time(Code)
Timing data -- when were we completely done



first_end
protected static long first_end(Code)
Timing data -- when did we end first set calculation



include_non_terms
protected static boolean include_non_terms(Code)
User option -- should we include non terminal symbol numbers in the symbol constant class.



input_file
protected static BufferedInputStream input_file(Code)
Input file. This is a buffered version of System.in.



lr_values
protected static boolean lr_values(Code)
User option -- should generator generate code for left/right values?



machine_end
protected static long machine_end(Code)
Timing data -- when did we end state machine construction



no_summary
protected static boolean no_summary(Code)
User option -- do not print a summary.



nullability_end
protected static long nullability_end(Code)
Timing data -- when did we end nullability calculation



opt_compact_red
protected static boolean opt_compact_red(Code)
User option -- do we compact tables by making most common reduce the default action



opt_do_debug
protected static boolean opt_do_debug(Code)
User option -- do we run produce extra debugging messages



opt_dump_grammar
protected static boolean opt_dump_grammar(Code)
User option -- do we produce a dump of the grammar



opt_dump_states
protected static boolean opt_dump_states(Code)
User option -- do we produce a dump of the state machine



opt_dump_tables
protected static boolean opt_dump_tables(Code)
User option -- do we produce a dump of the parse tables



opt_show_timing
protected static boolean opt_show_timing(Code)
User option -- do we show timing information as a part of the summary



parse_end
protected static long parse_end(Code)
Timing data -- when did we end parsing



parser_class_file
protected static PrintWriter parser_class_file(Code)
Output file for the parser class.



prelim_end
protected static long prelim_end(Code)
Timing data -- when did we end preliminaries



print_progress
protected static boolean print_progress(Code)
User option -- do we print progress messages.



reduce_check_end
protected static long reduce_check_end(Code)
Timing data -- when did we end checking for non-reduced productions



reduce_table
protected static parse_reduce_table reduce_table(Code)
Resulting reduce-goto table.



start_state
protected static lalr_state start_state(Code)
Start state in the overall state machine.



start_time
protected static long start_time(Code)
Timing data -- when did we start



suppress_scanner
protected static boolean suppress_scanner(Code)
User option -- should generator suppress references to java_cup.runtime.Scanner for compatibility with old runtimes?



sym_interface
protected static boolean sym_interface(Code)
User option -- should symbols be put in a class or an interface? [CSA]



symbol_class_file
protected static PrintWriter symbol_class_file(Code)
Output file for the symbol constant class.



table_end
protected static long table_end(Code)
Timing data -- when did we end table construction





Method Detail
build_parser
protected static void build_parser() throws internal_error(Code)
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.



check_unused
protected static void check_unused()(Code)
Check for unused symbols. Unreduced productions get checked when tables are created.



close_files
protected static void close_files() throws java.io.IOException(Code)
Close various files used by the system.



dump_grammar
public static void dump_grammar() throws internal_error(Code)
Produce a human readable dump of the grammar.



dump_machine
public static void dump_machine()(Code)
Produce a (semi-) human readable dump of the complete viable prefix recognition state machine.



dump_tables
public static void dump_tables()(Code)
Produce a (semi-) human readable dumps of the parse tables



emit_parser
protected static void emit_parser() throws internal_error(Code)
Call the emit routines necessary to write out the generated parser.



emit_summary
protected static void emit_summary(boolean output_produced)(Code)
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.
Parameters:
  output_produced - did the system get far enough to generate code.



main
public static void main(String argv) throws internal_error, java.io.IOException, java.lang.Exception(Code)
The main driver for the system.
Parameters:
  argv - an array of strings containing command line arguments.



open_files
protected static void open_files()(Code)
Open various files used by the system.



parse_args
protected static void parse_args(String argv)(Code)
Parse command line options and arguments to set various user-option flags and variables.
Parameters:
  argv - the command line arguments to be parsed.



parse_grammar_spec
protected static void parse_grammar_spec() throws java.lang.Exception(Code)
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.



plural
protected static String plural(int val)(Code)
Helper routine to optionally return a plural or non-plural ending.
Parameters:
  val - the numerical value determining plurality.



show_times
protected static void show_times()(Code)
Produce the optional timing summary as part of an overall summary.



timestr
protected static String timestr(long time_val, long total_time)(Code)
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).
Parameters:
  time_val - the value being formatted (in ms).
Parameters:
  total_time - total time percentages are calculated against (in ms).



usage
protected static void usage(String message)(Code)
Print a "usage message" that described possible command line options, then exit.
Parameters:
  message - a specific error message to preface the usage message by.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.