Implement a lexical and syntax analyzer

Assignment Help Programming Languages
Reference no: EM131393692

Programming Assignment -

Implement a lexical and syntax analyzer based on the following grammar. Your analyzer should read an input test program from a file and then determine if it contains a syntax error.  It does not have to show where the syntax error occurs or what kind of error it is.

<program>  → begin <statement_list> end

<statement_list> → <statement> {;<statement_list>}

<statement>  →  <assignment_statement> | <loop_statement>

<assignment_statement> → <variable> = <expression>

<variable> → identifier  (An identifier is a string that begins with a letter followed by 0 or more letters and/or digits)

<expression> → <variable> { (+|-) <variable>}          

<loop_statement> →  loop (<logic_expression>)  <statement>

<logic_expression> → <variable> (< | >) <variable>  (Assume that logic expressions have only less than or greater than operators)

Attachment:- Programming Assignment.rar

Verified Expert

The solution is created in netbeans and implemented lexical and syntax analyzer for the given expression. The solution file contains 3 programs LexicalAnalyser.java, syntaxAnalyzer.java and MainDemo.java (main program). The program input is in the file name of ProgramInput.The screen shot of the program is attached.

Reference no: EM131393692

Questions Cloud

Discuss a public issue that is pertinent your own experience : Addressing a Public Audience "Friends, Romans, Countrymen, lend me your ears!" So speaks Shakespeare's Marc Anthony upon the murder of Julius Caesar. The role of public debate has changed very little over time. We have more avenues now, and a wide..
How can we define and measure the term power : How can we define and measure the term 'POWER'? How does one define 'AUTHORITY'? What makes a source of POWER and AUTHORITY "legitimate" in the minds of people that a source of power is trying to rule over?
Challenges to nation-states did globalization bring about : What key challenges to nation-states did globalization bring about? First, describe what are nation-states and when they emerged; next, outline some of the key challenges to the nation-states today. Conclude by offering your opinion on whether they w..
The simplified keynesian model : A commercial bank's Deposits at The FED are: The simplified Keynesian model
Implement a lexical and syntax analyzer : Implement a lexical and syntax analyzer based on the following grammar. Your analyzer should read an input test program from a file and then determine if it contains a syntax error
What are similarities between business and public writing : Public Writing vs. Business Writing Now that we've reached the end of the course, it's important to reflect on the similarities and differences between the two main forms of writing studied in ENG 325: business writing and public writing. In this ..
What is meant by a strategy hierarchy : What are the desired characteristics of a national strategy document? What is meant by a strategy hierarchy? Identify the top three threats to homeland security and why you chose those as the primary threats.
May underestimate the true rate of unemployment : After earning her degree at SLCC School of Business then transferring to a four-year university, a recent accounting graduate is searching for a place to begin her career as an accountant. The current official unemployment rate of 4.6%, down from 4.9..
Describe the overall concepts of homeland security : Fully describe the overall concepts of homeland security and homeland defense. Construct a response that provides the following related to both homeland security and homeland defense.

Reviews

inf1393692

3/10/2017 3:22:12 AM

He is the best! Completed it rapidly. What's more, got an astounding evaluation on my task. He realizes what he is doing. Thanks again and again.

inf1393692

3/10/2017 3:20:25 AM

no plagiarism. sir, i just want to know if you used the 4 examples in the uploaded file,if so just send me the 4 files. because i needed 4 screenshots for each example. The screenshot you uploaded it says no syntax error and the examples says it is ,because the last statement shouldn’t end with a semicolon. can i get an answer asap the is the output i am getting 84115_1qq.PNG. in java language. cosc3127 programming assignment.doc

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd