Computer Science (Compiler Design)

    April 23, 2024

College of Computing and Informatics Assignment 1 Deadline: Day 03/03/2024 @ 23:59 [Total Mark for this Assignment is 8 ] Student Details: Name: ID: CRN: Instructions: • You must submit two separate copies (one Word file and one PDF file) using the Assignment Template on Blackboard via the allocated folder. These files must not be in compressed format. • It is your responsibility to check and make sure that you have uploaded both the correct files. • Zero mark will be given if you try to bypass the SafeAssign (e.g. misspell words, remove spaces between words, hide characters, use different character sets, convert text into image or languages other than English or any kind of manipulation). • Email submission will not be accepted. • You are advised to make your work clear and well-presented. This includes filling your information on the cover page. • You must use this template, failing which will result in zero mark. • You MUST show all your work, and text must not be converted into an image, unless specified otherwise by the question. • Late submission will result in ZERO mark. • The work should be your own, copying from students or other resources will result in ZERO mark. • Use Times New Roman font for all your answers. Question One Pg. 01 Learning Outcome(s): Understand the concept of scanning and parsing and constructing an Abstract Syntax Tree. Question One 2 Marks The parser is used to construct sentences out of words in a natural language by a context-free grammar (CFG) that considers the two subsets known as LL(1) and LR(1) grammars. a. What is the difference between LL(1) and LR(1) grammars. b. Find out whether the following grammar is LL(1) or not: S → aSbS | bSaS| ∈ Question Two Pg. 02 Learning Outcome(s): Understand the concept of scanning and parsing and constructing an Abstract Syntax Tree. Question Two 2 Marks A finite automaton (FA) is an abstract machine that can be used to represent certain forms of computation in a graph that consists of states and edges from an alphabet Σ. Convert the following regular expression to finite automaton (FA): (a|b)*(abb|a) Question Three Pg. 03 Learning Outcome(s): Understand the concept of scanning and parsing and constructing an Abstract Syntax Tree. Question Three 2 Marks Describe the concept of the abstract syntax tree (AST), and solve the following statement: for(a=10 ; a < 100 ; a 5) Print a; Question Four Pg. 04 Learning Outcome(s) Understand the concept of scanning and parsing and constructing an Abstract Syntax Tree. Question Four 2 Marks The symbol table is referenced throughout the semantic analysis stage to evaluate the correctness of some code, describe its concepts and six operations in details.

Trust your assignments to an essay writing service with the fastest delivery time and fully original content.

Verified