Please use the given grammar and the string to build a parse tree and an abstract syntax tree (refer to 05-01-abstract-syntax-trees.pdf page 4 and 5)(10 points) Given Grammar: E -> int | (E) | E+E Given String: 5+ (2+ (3+4)) E 1 ints LU E E E E • • • A parse tree: Traces the operation of the parser Captures nesting structu But too much informatic - Parentheses -Single-successor nodes E | int₂ int3 PLUS 5 PLUS Abstract Syntax 2 3 • Also captures the nesting structure • • But abstracts from the concrete syntax => more compact and easier to use An important data structure in a compiler

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section13.4: Linked Lists
Problem 4E
icon
Related questions
Question

Compilers. use the given grammar and the string to build a parse tree and an abstract syntax tree

Please use the given grammar and the string to build a parse tree and an abstract
syntax tree (refer to 05-01-abstract-syntax-trees.pdf page 4 and 5)(10 points)
Given Grammar: E -> int | (E) | E+E
Given String: 5+ (2+ (3+4))
Transcribed Image Text:Please use the given grammar and the string to build a parse tree and an abstract syntax tree (refer to 05-01-abstract-syntax-trees.pdf page 4 and 5)(10 points) Given Grammar: E -> int | (E) | E+E Given String: 5+ (2+ (3+4))
E
1
ints
LU
E
E
E
E
•
•
•
A parse tree:
Traces the operation of
the parser
Captures nesting structu
But too much informatic
- Parentheses
-Single-successor nodes
E
|
int₂
int3
PLUS
5
PLUS
Abstract Syntax
2
3
• Also captures the nesting structure
•
•
But abstracts from the concrete syntax
=> more compact and easier to use
An important data structure in a compiler
Transcribed Image Text:E 1 ints LU E E E E • • • A parse tree: Traces the operation of the parser Captures nesting structu But too much informatic - Parentheses -Single-successor nodes E | int₂ int3 PLUS 5 PLUS Abstract Syntax 2 3 • Also captures the nesting structure • • But abstracts from the concrete syntax => more compact and easier to use An important data structure in a compiler
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage