Java Doc for emit.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.emit

emit
public class emit (Code)
This class handles emitting generated code for the resulting parser. The various parse tables must be constructed, etc. before calling any routines in this class.

Three classes are produced by this code:

symbol constant class
this contains constant declarations for each terminal (and optionally each non-terminal).
action class
this non-public class contains code to invoke all the user actions that were embedded in the parser specification.
parser class
the specialized parser class consisting primarily of some user supplied general and initialization code, and the parse tables.

Three parse tables are created as part of the parser class:

production table
lists the LHS non terminal number, and the length of the RHS of each production.
action table
for each state of the parse machine, gives the action to be taken (shift, reduce, or error) under each lookahead symbol.
reduce-goto table
when a reduce on a given production is taken, the parse stack is popped back a number of elements corresponding to the RHS of the production. This reveals a prior state, which we transition out of under the LHS non terminal symbol for the production (as if we had seen the LHS symbol rather than all the symbols matching the RHS). This table is indexed by non terminal numbers and indicates how to make these transitions.

In addition to the method interface, this class maintains a series of public global variables and flags indicating how misc. parts of the code and other output is to be produced, and counting things such as number of conflicts detected (see the source code and public variables below for more details).

This class is "static" (contains only static data and methods).


See Also:   java_cup.main
version:
   last update: 11/25/95
author:
   Scott Hudson



Field Summary
protected static  boolean_lr_values
    
public static  Stringaction_code
     User declarations for direct inclusion in user action class.
public static  longaction_code_time
     Time to produce action code class.
public static  longaction_table_time
     Time to produce the action table.
public static  Stringclass_type_argument
    
public static  longgoto_table_time
     Time to produce the reduce-goto table.
public static  Stackimport_list
     List of imports (Strings containing class names) to go with actions.
public static  Stringinit_code
     User code for user_init() which is called during parser initialization.
public static  intnot_reduced
     Count of the number on non-reduced productions found.
public static  booleannowarn
    
public static  intnum_conflicts
     Number of conflict found while building tables.
public static  Stringpackage_name
     Package that the resulting code goes into (null is used for unnamed).
public static  Stringparser_class_name
     Name of the generated parser class.
public static  Stringparser_code
     User declarations for direct inclusion in parser class.
public static  longparser_time
     Time to produce parser class.
public static  Stringprefix
     The prefix placed on names that pollute someone else's name space.
public static  longproduction_table_time
     Time to produce the production table.
public static  Stringscan_code
     User code for scan() which is called to get the next Symbol.
public static  productionstart_production
     The start production of the grammar.
public static  Stringsymbol_const_class_name
     Name of the generated class for symbol constants.
public static  longsymbols_time
     Time to produce symbol constant class.
public static  intunused_non_term
     Count of unused non terminals.
public static  intunused_term
     Count of unused terminals.


Method Summary
public static  voidclear()
    
protected static  voiddo_action_table(PrintWriter out, parse_action_table act_tab, boolean compact_reduces)
     Emit the action table.
protected static  intdo_escaped(PrintWriter out, char c)
    
protected static  intdo_newline(PrintWriter out, int nchar, int nbytes)
    
protected static  voiddo_reduce_table(PrintWriter out, parse_reduce_table red_tab)
     Emit the reduce-goto table.
protected static  voiddo_table_as_string(PrintWriter out, short[][] sa)
    
protected static  voidemit_action_code(PrintWriter out, production start_prod)
     Emit code for the non-public class holding the actual action code.
protected static  voidemit_package(PrintWriter out)
     Emit a package spec if the user wants one.
protected static  voidemit_production_table(PrintWriter out)
     Emit the production table.
public static  booleanlr_values()
    
public static  voidparser(PrintWriter out, parse_action_table action_table, parse_reduce_table reduce_table, int start_st, production start_prod, boolean compact_reduces, boolean suppress_scanner)
     Emit the parser subclass with embedded tables.
protected static  Stringpre(String str)
     Build a string with the standard prefix.
protected static  voidset_lr_values(boolean b)
    
public static  voidsymbols(PrintWriter out, boolean emit_non_terms, boolean sym_interface)
     Emit code for the symbol constant class, optionally including non terms, if they have been requested.
protected static  StringtypeArgument()
     TUM changes; proposed by Henning Niss 20050628 Build a string with the specified type arguments, if present, otherwise an empty string.

Field Detail
_lr_values
protected static boolean _lr_values(Code)



action_code
public static String action_code(Code)
User declarations for direct inclusion in user action class.



action_code_time
public static long action_code_time(Code)
Time to produce action code class.



action_table_time
public static long action_table_time(Code)
Time to produce the action table.



class_type_argument
public static String class_type_argument(Code)
TUM changes; proposed by Henning Niss 20050628: Type arguments for class declaration



goto_table_time
public static long goto_table_time(Code)
Time to produce the reduce-goto table.



import_list
public static Stack import_list(Code)
List of imports (Strings containing class names) to go with actions.



init_code
public static String init_code(Code)
User code for user_init() which is called during parser initialization.



not_reduced
public static int not_reduced(Code)
Count of the number on non-reduced productions found.



nowarn
public static boolean nowarn(Code)
Do we skip warnings?



num_conflicts
public static int num_conflicts(Code)
Number of conflict found while building tables.



package_name
public static String package_name(Code)
Package that the resulting code goes into (null is used for unnamed).



parser_class_name
public static String parser_class_name(Code)
Name of the generated parser class.



parser_code
public static String parser_code(Code)
User declarations for direct inclusion in parser class.



parser_time
public static long parser_time(Code)
Time to produce parser class.



prefix
public static String prefix(Code)
The prefix placed on names that pollute someone else's name space.



production_table_time
public static long production_table_time(Code)
Time to produce the production table.



scan_code
public static String scan_code(Code)
User code for scan() which is called to get the next Symbol.



start_production
public static production start_production(Code)
The start production of the grammar.



symbol_const_class_name
public static String symbol_const_class_name(Code)
Name of the generated class for symbol constants.



symbols_time
public static long symbols_time(Code)
Time to produce symbol constant class.



unused_non_term
public static int unused_non_term(Code)
Count of unused non terminals.



unused_term
public static int unused_term(Code)
Count of unused terminals.





Method Detail
clear
public static void clear()(Code)



do_action_table
protected static void do_action_table(PrintWriter out, parse_action_table act_tab, boolean compact_reduces) throws internal_error(Code)
Emit the action table.
Parameters:
  out - stream to produce output on.
Parameters:
  act_tab - the internal representation of the action table.
Parameters:
  compact_reduces - do we use the most frequent reduce as default?



do_escaped
protected static int do_escaped(PrintWriter out, char c)(Code)



do_newline
protected static int do_newline(PrintWriter out, int nchar, int nbytes)(Code)



do_reduce_table
protected static void do_reduce_table(PrintWriter out, parse_reduce_table red_tab)(Code)
Emit the reduce-goto table.
Parameters:
  out - stream to produce output on.
Parameters:
  red_tab - the internal representation of the reduce-goto table.



do_table_as_string
protected static void do_table_as_string(PrintWriter out, short[][] sa)(Code)



emit_action_code
protected static void emit_action_code(PrintWriter out, production start_prod) throws internal_error(Code)
Emit code for the non-public class holding the actual action code.
Parameters:
  out - stream to produce output on.
Parameters:
  start_prod - the start production of the grammar.



emit_package
protected static void emit_package(PrintWriter out)(Code)
Emit a package spec if the user wants one.
Parameters:
  out - stream to produce output on.



emit_production_table
protected static void emit_production_table(PrintWriter out)(Code)
Emit the production table.
Parameters:
  out - stream to produce output on.



lr_values
public static boolean lr_values()(Code)
whether or not to emit code for left and right values



parser
public static void parser(PrintWriter out, parse_action_table action_table, parse_reduce_table reduce_table, int start_st, production start_prod, boolean compact_reduces, boolean suppress_scanner) throws internal_error(Code)
Emit the parser subclass with embedded tables.
Parameters:
  out - stream to produce output on.
Parameters:
  action_table - internal representation of the action table.
Parameters:
  reduce_table - internal representation of the reduce-goto table.
Parameters:
  start_st - start state of the parse machine.
Parameters:
  start_prod - start production of the grammar.
Parameters:
  compact_reduces - do we use most frequent reduce as default?
Parameters:
  suppress_scanner - should scanner be suppressed for compatibility?



pre
protected static String pre(String str)(Code)
Build a string with the standard prefix.
Parameters:
  str - string to prefix.



set_lr_values
protected static void set_lr_values(boolean b)(Code)



symbols
public static void symbols(PrintWriter out, boolean emit_non_terms, boolean sym_interface)(Code)
Emit code for the symbol constant class, optionally including non terms, if they have been requested.
Parameters:
  out - stream to produce output on.
Parameters:
  emit_non_terms - do we emit constants for non terminals?
Parameters:
  sym_interface - should we emit an interface, rather than a class?



typeArgument
protected static String typeArgument()(Code)
TUM changes; proposed by Henning Niss 20050628 Build a string with the specified type arguments, if present, otherwise an empty string.



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.