0% found this document useful (0 votes)
49 views7 pages

Syntax Directed Translation

Syntax Directed Translation (SDT) is a compiler method that translates programming languages by associating attributes with grammar symbols and defining semantic rules. It includes Syntax Directed Definitions (SDD) with context-free grammar, attributes, and rules for attribute computation, and can be categorized into S-Attributed and L-Attributed types. SDT is essential for semantic analysis, syntax tree generation, and efficient compiler design.

Uploaded by

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

Syntax Directed Translation

Syntax Directed Translation (SDT) is a compiler method that translates programming languages by associating attributes with grammar symbols and defining semantic rules. It includes Syntax Directed Definitions (SDD) with context-free grammar, attributes, and rules for attribute computation, and can be categorized into S-Attributed and L-Attributed types. SDT is essential for semantic analysis, syntax tree generation, and efficient compiler design.

Uploaded by

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

SYNTAX DIRECTED

TRANSLATION (SDT)

PREPARED BY: GAURAV JANMARE

ROLL NO :37

SUBJECT :COMPILER CONSTRUCTOR


INTRODUCTION TO SYNTAX
DIRECTED TRANSLATION
• Syntax Directed Translation (SDT) is a method
used in compilers for translating programming
languages.
• It associates attributes with grammar symbols
and semantic rules to define how translation is
performed.
• SDT is useful in syntax analysis and code
generation.
SYNTAX DIRECTED
DEFINITIONS (SDD)
• SDD consists of:
- A context-free grammar.
- Attributes associated with grammar symbols.
- Semantic rules that define attribute
computation.
• Attributes can be synthesized or inherited.
TYPES OF SDT

1. S-Attributed SDT:
- Uses only synthesized attributes.
- Evaluated in a bottom-up manner.
2. L-Attributed SDT:
- Uses both inherited and synthesized
attributes.
- Evaluated in a left-to-right order.
EXAMPLE OF SDT

Example Grammar:
E → E1 + T { E.val = E1.val + T.val }
T → T1 * F { T.val = T1.val * F.val }
The rules compute attribute values during
parsing.
APPLICATIONS OF SDT

• Used in compilers for semantic analysis.


• Helps in syntax tree generation and
intermediate code generation.
• Used in attribute grammars for language
translation.
CONCLUSION

• Syntax Directed Translation helps in processing


language syntax and semantics together.
• It plays a crucial role in compiler design for
efficient translation.
• Understanding SDT is essential for building
better language processors.

You might also like