Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Syntax-directed translation

From Wikipedia, the free encyclopedia

Syntax-directed translation refers to a method ofcompiler implementation where the source language translation is completely driven by theparser.

A common method of syntax-directed translation is translating a string into a sequence of actions by attaching one such action to each rule of agrammar.[1] Thus, parsing a string of the grammar produces a sequence of rule applications. SDT provides a simple way to attachsemantics to any suchsyntax.

Overview

[edit]

Syntax-directed translation fundamentally works by adding actions to the productions in acontext-free grammar, resulting in a Syntax-Directed Definition (SDD).[2] Actions are steps or procedures that will be carried out when that production is used in a derivation. A grammar specification embedded with actions to be performed is called asyntax-directed translation scheme[1] (sometimes simply called a 'translation scheme'.)

Each symbol in the grammar can have anattribute, which is a value that is to be associated with the symbol. Common attributes could include a variable type, the value of an expression, etc. Given a symbolX, with an attributet, that attribute is referred to asX.t

Thus, given actions and attributes, the grammar can be used for translating strings from its language by applying the actions and carrying information through each symbol's attribute.

Metacompilers

[edit]

Early metacompilers use the terms syntax-driven and syntax-directed translation in their descriptions. They havemetaprogramming language features for outputting code.

Seemetacompiler,META II, andTREE-META.

See also

[edit]

References

[edit]
  1. ^abGurari, Eitan M."Syntax-Directed Translation Schemes (SDTS's)". Archived fromthe original on 28 July 2012.
  2. ^Aho, Alfred V.Compilers: Principles, Techniques, & Tools. Boston: Pearson/Addison Wesley, 2007.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Syntax-directed_translation&oldid=1264816973"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp