Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Lexical Analyzer:

Symbol Table - Holds the symbols accepted by the lexical analyzer or parser.

Each symbol may be a terminal or a non-terminal.  Terminal symbols are listed first in the table ahead of non-terminals.

Attributes:

  • Count - Number of symbols in the table

Child items:

  • Symbol

Symbol - Individual symbol accepted by the lexical analyzer or parser. 

Attributes:

  • Index - Unique symbol identifier in the symbol table
  • Name - Name assigned to symbol in the grammar
  • Kind - Indicates the type of symbols.  (0- nonterminal, 1 - terminal, other types are self evident)

Char Sets - Groups of characters that can trigger one (or more) DFA state transitions. 

Attributes:

  • Index - Unique identifier for a given character set
  • Count - Number of characters in a given character set

Child items:

  • Char

Char - Specifies the individual character (no array needed)

Attributes:

  • UnicodeIndex - Character code in Unicode (ASCII)

DFA Table - Holds all the DFA states that make up the lexical analyzer. 

Attributes:

  • Count - Number of DFA states
  • Initial state

Child Items:

  • DFA State

DFA State - Enumerates each DFA state and the edges that transition from that state.

Attributes:

  • Index - Unique identifier (order in the DFA table)
  • EdgeCount - Number of edges from the current state to other DFA states
  • AcceptSymbol - Is this an accept state?
    • -1=false
    • Otherwise, it gives the number of the symbol index the state accepts

Child items:

  • DFA Edge

DFA Edge - Transition from one DFA state to another

Attributes:

  • Char Set Index - Points to the character set whose input causes the transition.  Thus, a single transition may be cause by multiple characters.
  • Target - Points to the destination state for the transition

LALR Parser:

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

Attributes:

  • 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.

Attributes:

  • 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). 

Attributes:

  • 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. 

Attributes:

  • 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.

Attributes:

  • 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. 

Attributes:

  • 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

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9132217

Have any Question?


Related Questions in Programming Language

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As