[SOLVED] 代写 C compiler Hmk3 Parser

30 $

File Name: 代写_C_compiler_Hmk3_Parser.zip
File Size: 273.18 KB

SKU: 6818281224 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


Hmk3 Parser
Instructor: Zhiyao Liang
Macau University of Science and Technology 2019 FAll
Purpose
Construct a syntax analyzer, also called a parser for the specified source language. The above picture is found from the internet and shows some ideas of parsing a sentence.
The source language
The source language is documented in the file . Some sample programs of this language are in the folder .
The Helpful code
Some code files are provided in the two folders:
: It contains code of suggested token types, and how to read and print token lists from and to files. The readme.txt file in this folder explains more details. You can load a token list into memory, and then use it to build your parser.
some_parser_code : Some code files of a parser for another C-like language are provided. These files are not complete, and cannot be directly used for a parser of language N.
You can use or modify the provided code. Or you can use your own code.
The_language_N.pdf
Sample_N_programs
TokenIO
.txt

The code provided by the textbook is already uploaded to the FTP site of this course, which could also be helpful.
The task
1. Design the context-free grammar rules for the N language. Similar rules for another language are discussed in class. Include the designed rules in a .txt file. Also put these rules as some comments in your code.
2. Write a program using C to implement a parser for language N, using the recursive method, i.e., translate each rule as a function. Given a list of tokens, the parser can build a syntax tree, and report errors if there are some.
3. Test your parser with some correct .n files, and some .n files with syntax errors (modify the correct files, like delete a comma, or bracket …)
When a ‘.n’ file is correct, some syntax tree (also called parse tree) should be printed. When some error is in the ‘.n’ file, (at least one) error message should be printed.
The folder shows some expected behavior of running a parser with the provided files. The tokens do not need to be printed.
How to submit
Submit before Dec 9, Monday, 9pm.
At most three students can form a group to do the homework together and submit the homework together with an email. If you can do the homework by yourself (a one-person group), it surely will be fine.
Submit the homework by sending an email (to [email protected] ) with attached program files (together with the file of the grammar rules). The details of how to submit your homework is in the file how_to_submit_homeworks.pdf .
References
1. Kenneth C. Louden. Compiler Construction Principles and Practice. PWS Publishing Company, 1997. ISBN 0-534-93972-4 http://www.cs.sjsu.edu/~louden/cmptext/.
2. Andrew W. Appel. Modern Compiler Implementation in C: Basic Tech- niques. Cambridge University Press, New York, NY, USA, 1997.
N_sample_run_parser
.n
textbook_code.zip

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 C compiler Hmk3 Parser
30 $