Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java_cup.runtime.* (4)

java_cup: Javadoc index of package java_cup.


Package Samples:

java_cup.runtime

Classes:

lr_parser: This class implements a skeleton table driven LR parser. In general, LR parsers are a form of bottom up shift-reduce parsers. Shift-reduce parsers act by shifting input onto a parse stack until the Symbols matching the right hand side of a production appear on the top of the stack. Once this occurs, a reduce is performed. This involves removing the Symbols corresponding to the right hand side of the production (the so called "handle") and replacing them with the non-terminal from the left hand side of the production. To control the decision of whether to shift or reduce at any given point, the ...
Main: 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 ...
lalr_state: This class represents a state in the LALR viable prefix recognition machine. A state consists of an LALR item set and a set of transitions to other states under terminal and non-terminal symbols. Each state represents a potential configuration of the parser. If the item set of a state includes an item such as: [A ::= B * C d E , {a,b,c}] this indicates that when the parser is in this state it is currently looking for an A of the given form, has already seen the B, and would expect to see an a, b, or c after this sequence is complete. Note that the parser is normally looking for several things at ...
emit: 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 ...
lexer: This class implements a small scanner (aka lexical analyzer or lexer) for the JavaCup specification. This scanner reads characters from standard input (System.in) and returns integers corresponding to the terminal number of the next Symbol. Once end of input is reached the EOF Symbol is returned on every subsequent call. Symbols currently returned include: Symbol Constant Returned Symbol Constant Returned ------ ----------------- ------ ----------------- "package" PACKAGE "import" IMPORT "code" CODE "action" ACTION "parser" PARSER "terminal" TERMINAL "non" NON "init" INIT "scan" SCAN "with" WITH ...
lalr_item: This class represents an LALR item. Each LALR item consists of a production, a "dot" at a position within that production, and a set of lookahead symbols (terminal). (The first two of these parts are provide by the super class). An item is designed to represent a configuration that the parser may be in. For example, an item of the form: [A ::= B * C d E , {a,b,c}] indicates that the parser is in the middle of parsing the production A ::= B C d E that B has already been parsed, and that we will expect to see a lookahead of either a, b, or c once the complete RHS of this production has been found. ...
production: This class represents a production in the grammar. It contains a LHS non terminal, and an array of RHS symbols. As various transformations are done on the RHS of the production, it may shrink. As a result a separate length is always maintained to indicate how much of the RHS array is still valid. I addition to construction and manipulation operations, productions provide methods for factoring out actions (see remove_embedded_actions()), for computing the nullability of the production (i.e., can it derive the empty string, see check_nullable()), and operations for computing its first set (i.e., ...
virtual_parse_stack: This class implements a temporary or "virtual" parse stack that replaces the top portion of the actual parse stack (the part that has been changed by some set of operations) while maintaining its original contents. This data structure is used when the parse needs to "parse ahead" to determine if a given error recovery attempt will allow the parse to continue far enough to consider it successful. Once success or failure of parse ahead is determined the system then reverts to the original parse stack (which has not actually been modified). Since parse ahead does not execute actions, only parse state ...
version: This class contains version and authorship information. It contains only static data elements and basically just a central place to put this kind of information so it can be updated easily for each release. Version numbers used here are broken into 3 parts: major, minor, and update, and are written as v . . (e.g. v0.10a). Major numbers will change at the time of major reworking of some part of the system. Minor numbers for each public release or change big enough to cause incompatibilities. Finally update letter will be incremented for small bug fixes and changes that probably wouldn't be noticed ...
lr_item_core: The "core" of an LR item. This includes a production and the position of a marker (the "dot") within the production. Typically item cores are written using a production with an embedded "dot" to indicate their position. For example: A ::= B * C d E This represents a point in a parse where the parser is trying to match the given production, and has succeeded in matching everything before the "dot" (and hence is expecting to see the symbols after the dot next). See lalr_item, lalr_item_set, and lalr_start for full details on the meaning and use of items.
symbol: This abstract class serves as the base class for grammar symbols (i.e., both terminals and non-terminals). Each symbol has a name string, and a string giving the type of object that the symbol will be represented by on the runtime parse stack. In addition, each symbol maintains a use count in order to detect symbols that are declared but never used, and an index number that indicates where it appears in parse tables (index numbers are unique within terminals or non terminals, but not across both).
lalr_item_set: This class represents a set of LALR items. For purposes of building these sets, items are considered unique only if they have unique cores (i.e., ignoring differences in their lookahead sets). This class provides fairly conventional set oriented operations (union, sub/super-set tests, etc.), as well as an LALR "closure" operation (see compute_closure()).
terminal: This class represents a terminal symbol in the grammar. Each terminal has a textual name, an index, and a string which indicates the type of object it will be implemented with at runtime (i.e. the class of object that will be returned by the scanner and pushed on the parse stack to represent it).
nonassoc_action: This class represents a shift/reduce nonassociative error within the parse table. If action_table element is assign to type nonassoc_action, it cannot be changed, and signifies that there is a conflict between shifting and reducing a production and a terminal that shouldn't be next to each other.
non_terminal: This class represents a non-terminal symbol in the grammar. Each non terminal has a textual name, an index, and a string which indicates the type of object it will be implemented with at runtime (i.e. the class of object that will be pushed on the parse stack to represent it).
lalr_transition: This class represents a transition in an LALR viable prefix recognition machine. Transitions can be under terminals for non-terminals. They are internally linked together into singly linked lists containing all the transitions out of a single state via the _next field.
parse_action: This class serves as the base class for entries in a parse action table. Full entries will either be SHIFT(state_num), REDUCE(production), NONASSOC, or ERROR. Objects of this base class will default to ERROR, while the other three types will be represented by subclasses.
action_part: This class represents a part of a production which contains an action. These are eventually eliminated from productions and converted to trailing actions by factoring out with a production that derives the empty string (and ends with this action).
parse_reduce_table: This class represents the complete "reduce-goto" table of the parser. It has one row for each state in the parse machines, and a column for each terminal symbol. Each entry contains a state number to shift to as the last step of a reduce.
production_part: This class represents one part (either a symbol or an action) of a production. In this base class it contains only an optional label string that the user can use to refer to the part within actions. This is an abstract class.
parse_action_table: This class represents the complete "action" table of the parser. It has one row for each state in the parse machine, and a column for each terminal symbol. Each entry in the table represents a shift, reduce, or an error.
action_production: A specialized version of a production used when we split an existing production in order to remove an embedded action. Here we keep a bit of extra bookkeeping so that we know where we came from.
Scanner: Defines the Scanner interface, which CUP uses in the default implementation of lr_parser.scan() . Integration of scanners implementing Scanner is facilitated.
reduce_action: This class represents a reduce action within the parse table. The action simply stores the production that it reduces with and responds to queries about its type.
Symbol: Defines the Symbol class, which is used to represent all terminals and nonterminals while parsing. The lexer should pass CUP Symbols and CUP returns a Symbol.

Home | Contact Us | Privacy Policy | Terms of Service