Home » 2. (8 Marks] Suppose You Wanted To Construct An Abstract Syntax Tree From Parse

# 2. (8 Marks] Suppose You Wanted To Construct An Abstract Syntax Tree From Parse

Transcribed Image Text from this Question2. (8 marks] Suppose you wanted to construct an abstract syntax tree from parse tree derived by using the grammar specified in Figure 1. Give an S-attributed grammar that creates an abstract syntax tree composed of the following kinds of tree nodes as illustrated in the UML diagram below. ASTNode LiteralASTNode LiteralASTNode (Number) ListASTNode ListASTNode (ASTNode) prependNode(ASTNode) : void appendNode (ASTNode) : void IdentifierASTNode IdentifierASTNode(String) QuotedASTNode QuotedASTNode (ASTNode) All that is required is to create an abstract syntax tree. Observe that all you will need for most types of nodes is just the constructor (as shown) but for ListASTNode two methods are provided to prepend and append nodes to a list. You will need one of these methods, depending on how you structure your attribute grammar. Please provide both the semantic rules and the attributes using notation similar to that in question 1. Provide a brief explanation of how the grammar works. 1 S → Atoms Atoms Atoms → Atom Atoms Atom Atom Atom id Atom int Atom → (Atoms ) Figure 1: A simplified grammar for Scheme.

A) (4 Points) Compute The Remainder And The Quotient For 1) 46 Div 22
Transcribed Image Text from this Questiona) (4 points) Compute the remainder and the quotient for 1) 46 div 22 = 46 mod 22 = 2) -3 div -4 = -3 mod -4 = b) (2 points) Find the prime factorization in canonical form for 165 165= c) (6 points) Find GCD(55,230), GCD(-7,13) using Euclidean Algorithm d) (2 points) Which of the above pairs are relatively prime? why? e) (2 points) Find LCM(55,230)

Come Up With A Recurrence Relation (mathematical Expression Of The Recursive Function) For

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

### Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

### Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

### Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.