0% found this document useful (0 votes)
26 views1 page

SDT SDT

Sdt compiler

Uploaded by

thedoomsday8906
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views1 page

SDT SDT

Sdt compiler

Uploaded by

thedoomsday8906
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Aspect Syntax-Directed Definition Syntax-Directed

(SDD) Translation (SDT)


Definition A formal way to define the A method to specify the
attributes of the grammar translation of source
symbols and rules language constructs
Purpose Used for attribute evaluation Used for translating and
in a parse tree generating intermediate
code
Attributes Synthesized and inherited Actions (semantic rules)
attributes associated with embedded in the grammar
grammar symbols
Evaluation Attributes are evaluated Semantic actions are
based on the rules executed during parsing
Grammar Attribute grammar Augmented grammar with
Type embedded actions
Focus Focuses on defining the Focuses on translating
meaning of constructs constructs to another form
Semantic Written as equations or rules Written as actions within the
Rules in the production production rules
Execution Can be evaluated in any order Executed during parsing,
Timing that respects dependencies often in a single pass
Parse Tree Annotates the parse tree with Produces intermediate code
attribute values while parsing
Example Type checking, scope Code generation,
Usage resolution intermediate code
representation
Flexibility More flexible in defining More direct and efficient for
complex attributes simple translations
Dependency Requires explicit handling of Managed inherently by the
Handling attribute dependencies parsing process
Complexity Can be complex due to Typically simpler due to
dependency management direct execution

You might also like