Lalr parser - xml table output, Programming Languages

LALR Parser:

Rule Table - Contains definitions of production rules within the grammar.


  • Count - Number of production rules in the table

Child items:

  • Rule

Rule - Defines a given production rule in the grammar.  Each production rule has a Left Hand Side (LHS) which is a single non-terminal) and a Right Hand Side (RHS), which can be a mix of terminals and non-terminals.  This structure can be used to determine how many and which symbols to pop off the parser stack during a reduction.  The LHS symbol must be placed on the parser stack to complete the rule reduction.


  • Index - Unique identifier of rule in the rule table
  • NonTerminalIndex - Provides the index for the non-terminal symbol (LHS) in the symbol table.
  • Symbol Count - number of symbols in the RHS of the production

Child items:

  • Rule Symbol

Rule Symbol - Defines a terminal or non-terminal in the RHS of the rule.  Symbols are listed in order of appearance on the RHS (from leftmost to rightmost). 


  • SymbolIndex - Provides the index into the symbol table for the particular symbol on the RHS of the production

LALR Table - This structure represents the LALR parse table.  Recall from class that the LALR table has symbols (terminals and non-terminals) on its X-Axis and LALR states on its Y-Axis (refer to class slides).  This table is defined in terms of states, which call out the appropriate symbols that are applicable to that state.


  • Count - Total number of LALR states in the table
  • Initial State - Start state for the parser (nominally state 0)

Child items:

  • LALR State

LALR State - This item defines a given state in the LALR parse table.  Each state is mapped to one or more symbols.  For each mapping, an action is specified (shift, reduce, goto, or accept).  If a state does not reference a symbol, then no action is specified when the parser is in that state and the symbol is at the front of the input queue-in short, this is a parser error.


  • Index - State number within the table
  • Action count - Number of actions associated with a given state (at least one)

Child items:

  • LALR Action

LALR Action - This item defines the action for a given state-symbol pair.  Since the LALR Action is a child of LALR State, all listed actions are associated with the parent state.  Each pair will have a single mapping associated with it of type:  shift, reduce, goto, or accept. 


  • SymbolIndex - The index of the symbol mapped to the LALR state for this action.
  • Action - The type of action being accomplished.  Actions:  1- Shift, 2- Reduce, 3 - Goto, 4 - Accept.
  • Value - The meaning of this value is dependent on the action type.  For a shift or goto action, the value refers to the next LALR state.  For a reduce action, the value refers to the rule index in the Rule Table.  For an accept action, the value is meaningless (nominally 0) as it ends the parsing process for a given statement.




Best Programming Strategy:

  • Mimic the GPB XML structure
  • Implement each structure that has items as an array of objects



Posted Date: 3/25/2013 5:49:01 AM | Location : United States

Related Discussions:- Lalr parser - xml table output, Assignment Help, Ask Question on Lalr parser - xml table output, Get Answer, Expert's Help, Lalr parser - xml table output Discussions

Write discussion on Lalr parser - xml table output
Your posts are moderated
Related Questions
Shopping Cart Purpose – Allows user to browse while keeping track of the items in which they will purchase at the end on the order page link and this will give a final price for al

Dynamic Binding: - Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding (late binding) means that the code associa

The reader-writer problem can be stated as follows: A shared memory location can be concurrently read by any number of tasks, but when a task must write to the shared memory locati

The purpose of the HB Programming test is to assess whether a candidate has sufficient knowledge to join our team here and beyond that where they would fit within our teams. The

Question: (i) Each time a security mechanism is installed or deleted in a Digital UNIX system, SIA is involved. Draw a Security Integration Architecture diagram. (ii) How

Scenario A campsite provides cabins for travellers to stay in overnight. A 'cabin' is a small wooden hut, containing bunk beds, table and chairs, a heater, and a small cookin

Programming Project Specification: IRC or Internet Relay Chat is an application that lets multiple users communicate via text messages with each other in common "virtual" rooms.

What is URL describe theri protocol? URL basicallt stands for uniform resource locator. A URL is a pointer to a particular resource on the Internet at a particular location.

You are to Use ASCII operations to design an IA-32 assembly language program which will do addition and subtraction on positive integers of any length represented in characters. T