Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Develop the C or C++ source code required to solve the following problem

12/10/2020 Client: arwaabdullah Deadline: 10 Days

CS 3361 | Fall 2020 | Assignment #3 Lexical Analyzer


Assignment #3


Lexical Analyzer


Develop the C or C++ source code required to solve the following problem.


Problem


Develop a lexical analyzer in C or C++ that can identify lexemes and tokens found in a source code file provided by the user. Once the analyzer has identified the lexemes of the language and matched them to a token group, the program should print each lexeme / token pair to the screen.


The source code file provided by the user will be written in a new programming language called “DanC” and is based upon the following grammar (in BNF):


P ::= S S ::= V:=E | read(V) | write(V) | while C do S od | S;S C ::= E < E | E > E | E = E | E <> E | E <= E | E >= E E ::= T | E + T | E - T T ::= F | T * F | T / F F ::= (E) | N | V V ::= a | b | … | y | z | aV | bV | … | yV | zV N ::= 0 | 1 | … | 8 | 9 | 0N | 1N | … | 8N | 9N


Your analyzer should accept the source code file as a required command line argument and display an appropriate error message if the argument is not provided or the file does not exist. The command to run your application will look something like this:


Form: danc_analyzer <path_to_source_file>


Example: danc_analyzer test_file.danc


Lexeme formation is guided using the BNF rules / grammar above. Your application should output each lexeme and its associated token. Invalid lexemes should output UNKNOWN as their token group. The following token names should be used to identify each valid lexeme:


Lexeme


Token


Lexeme


Token


Lexeme


Token := ASSIGN_OP + ADD_OP do KEY_DO


<


LESSER_OP


-


SUB_OP


od


KEY_OD > GREATER_OP * MULT_OP <variable name> IDENT


=


EQUAL_OP


/


DIV_OP


<integer>


INT_LIT <> NEQUAL_OP read KEY_READ ( LEFT_PAREN


<=


LEQUAL_OP


write


KEY_WRITE


)


RIGHT_PAREN >= GEQUAL_OP while KEY_WHILE ; SEMICOLON


CS 3361 | Fall 2020 | Assignment #3 Lexical Analyzer


Additional Solution Rules


Your solution must conform to the following rules:


1) Your solution should be able to use whitespace, tabs, and end of line characters as delimiters between lexemes, however your solution should ignore these characters and not report them as lexemes nor should it require these characters to delimit lexemes of different types.


a. Example: “while i<=n do”


i. This line will generate 5 lexemes “while”, “i”, “<=”, “n”, and “do”.


ii. This means the space between “while” and “i” separated the two lexemes but wasn’t a lexeme itself.


iii. This also means that no space is required between the lexemes “i”, “<=”, and “n”.


2) Your solution should print out “DanC Analyzer :: R<#>” on the first line of output. The double colon “::” is required for correct grading of your submission.


3) Your solution must be tested to ensure compatibility with the GNU C/C++ compiler version 5.4.0.


4) Lexemes that do not match to a known token should be reported as an “UNKNOWN” token. This should not stop execution of your program or generate an error message.


Hints


1) Draw inspiration by looking at the lexical analyzer code discussed and distributed in class.


2) Start by focusing on writing the program in your usual C/C++ development environment.


3) Once your solution is correct, then work on testing it in Linux using the appropriate version of the GNU compiler (gcc).


4) Linux/Makefile tutorials:


a. Linux Video walkthrough: http://www.depts.ttu.edu/hpcc/about/training.php#intro_linux


b. Linux Text walkthrough: http://www.ee.surrey.ac.uk/Teaching/Unix/


c. Makefile tutorial: https://www.tutorialspoint.com/makefile/index.htm


What to turn in to BlackBoard


A zip archive (.zip) containing the following files:


• <FirstName>_<LastName>_<R#>_Assignment3.c / <FirstName>_<LastName>_<R#>_Assignment3.cpp


o C/C++ Source code file


o Example: Eric_Rees_R123456_Assignment3.c


• Makefile


o A makefile for compiling your C/C++ file.


o This makefile must work in the HPCC environment to compile your source code file and output an executable named danc_analyzer.


CS 3361 | Fall 2020 | Assignment #3 Lexical Analyzer


Example Execution


The example execution below was run on Quanah, one of the HPCC clusters. It shows all the commands used to compile and execute my analyzer. Bolded text is text from the Linux OS, text in red are the commands I typed and executed, and the text in blue represents the output from each step.


quanah:/assignment_3$ make clean


rm -f danc_analyzer


quanah:/assignment_3$ make


gcc -o danc_analyzer Eric_Rees_R123456_Assignment3.c


quanah:/assignment_3$ ./danc_analyzer test.danc


DanC Analyzer :: R123456


f IDENT


:= ASSIGN_OP


1 INT_LIT


; SEMICOLON


i IDENT


:= ASSIGN_OP


1 INT_LIT


; SEMICOLON


read KEY_READ


( LEFT_PAREN


n IDENT


) RIGHT_PAREN


; SEMICOLON


while KEY_WHILE


i IDENT


<= LEQUAL_OP


n IDENT


do KEY_DO


f IDENT


:= ASSIGN_OP


f IDENT


* MULT_OP


i IDENT


; SEMICOLON


i IDENT


:= ASSIGN_OP


i IDENT


+ ADD_OP


1 INT_LIT


od KEY_OD


; SEMICOLON

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Custom Coursework Service
Peter O.
Finance Homework Help
Writer Writer Name Offer Chat
Custom Coursework Service

ONLINE

Custom Coursework Service

Hey, Hope you are doing great :) I have read your project description. I am a high qualified writer. I will surely assist you in writing paper in which i will be explaining and analyzing the formulation and implementation of the strategy of Nestle. I will cover all the points which you have mentioned in your project details. I have a clear idea of what you are looking for. The work will be done according to your expectations. I will provide you Turnitin report as well to check the similarity. I am familiar with APA, MLA, Harvard, Chicago and Turabian referencing styles. I have more than 5 years’ experience in technical and academic writing. Please message me to discuss further details. I will be glad to assist you out.

$55 Chat With Writer
Peter O.

ONLINE

Peter O.

Hello, I can assist you in writing attractive and compelling content on ganja and its movement globally. I will provide with valuable, informative content that you will appreciate. The content will surely hit your target audience. I will provide you with the work that will be according to the needs of the targeted audience and Google’s requirement.

$55 Chat With Writer
Finance Homework Help

ONLINE

Finance Homework Help

I have a Master’s degree and experience of more than 5 years in this industry, I have worked on several similar projects of Research writing, Academic writing & Business writing and can deliver A+ quality writing even to Short Deadlines. I have successfully completed more than 2100+ projects on different websites for respective clients. I can generally write 10-15 pages daily. I am interested to hear more about the project and about the subject matter of the writing. I will deliver Premium quality work without Plagiarism at less price and time. Get quality work by awarding this project to me, I look forward to getting started for you as soon as possible. Thanks!

$55 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Ethical Theory - History of the eiffel tower worksheet answers - Week6 - Bsbfim501 pdf - Summation of forces in cricket - Yalom and leszcz 2005 therapeutic factors - A good speech for house captain - Discussion - Approaches to psychology practice worksheet answers - Crown employees award 2017 police - Lora modem designer's guide - What is a secondment - Paint net lesson plans - St george netball association - Pull strategy in supply chain - Deploying an ovf with nvram is not supported - Royal north shore parking - Vending machine program in python - Data at rest threats - Is dice singular or plural - Improving literacy in secondary schools a shared responsibility - How to calculate correlation coefficient on calculator casio - Persuasive speech outline monroe's motivated sequence - Divergence of a vector in cylindrical coordinates - How do the perspectives differ from the ethical theories - Lane bryant coupon august 2018 - Week 40 - Marketing business plan - Smart goal powerpoint for students - Exchange rate shifts that cause the sing - MBA 599 Discussion #4 - Security infrastructure design document - Durban's finest??(((((0835179056))??$$abortion pills for sale in durban north mkondeni Ashdown chesterville NAMIBIA Botswana kwazulu_natal - How to activate ti nspire cas software - Acetic acid + lithium hydroxide - Gcu loudcloud learning management system - Was ned kelly a hero or criminal - Saint stithians past papers - Math 221 statistics for decision making week 6 ilab - Economics Questions - Forecasting simulation pearson gas answers - Hayman reese 5th wheel hitch australia - Vcaa biology exam answers - Ms groves has trays of paints for students - A firm's demand curve is given by p 500 2q - Discussion - Coleg y cymoedd moodle - What does redeployee mean - Fama french three factor model excel - Control objectives for information and related technology pdf - Mental - Leadership in organizations yukl 9th edition pdf - 6 pages please see attachment for notes - The function of the existentially oriented counselor is to - How to neutralize chemical equations - And write a summary of more than 1000 words. - Pure substance vs mixture - Delce healthy living centre - Dimensions of human behavior person and environment 6th edition pdf - Revlon crazy shine nail buffer walgreens - Tina jones abdominal shadow health - Mid semester break uq - Essay nursing - 3 bit comparator circuit - Leica disto x310 manual - Define horizontal integration in healthcare - Socw 6456 assignment - THEORY - Children of Heaven moview review - Integrating Writing - Initiating the Project - Problem Set 6 - Guidelines to formal etiquette quite clearly stipulate that - The author to her book literary devices - Standard error of measurment - Heroes and role models - Feed by mt anderson characters - How does the american deaf community benefits from the ada - Prevention Program Power point - Which of the following activities uses the most water in a typical household? - 5910_ASS 6 # REwork - Compare and contrast essay between two countries - Asos ecommerce case study - General Chemistry Homework Assignment - 13 jenkins st taroona - The beatles eleanor rigby meaning - Virus explorer click and learn answer keY - Ben herden mortgage choice - Water by the spoonful by quiara alegría hudes pdf - Discussion question answer each question in the sentence 100 words - Module 03 Course Project - Medicaid and the Middle Class - 68hc11 assembly language examples - Iag nestle com password manager - I have a headache this weather stinks actual punchline - Paid rent for the month journal entry - Sula - Oxygen lewis dot structure - Gender and women's studies critical terrain second edition - How to make ochre paint - Powerpoint assignment PH.D LEVEL - Give me liberty chapter 7 focus questions