Talk:Syntax-directed translation

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Copyright?[edit]

This appears to be a verbatim copy of Chapter 11 of "Compilers and Compiler Generators" copyright P.D. Terry 1996.

Pat's website states:

The text of the book is Copyright © PD Terry. Although you are free to make use of the material for study and academic purposes, please do not redistribute it without my knowledge or permission.

1. Is this here with his permission?
2. If so, it needs to be edited.

--nemo (talk) 16:44, 17 March 2008 (UTC)[reply]

Thank you for spotting this. I have reverted the article to the previous version. — Tobias Bergemann (talk) 08:52, 18 March 2008 (UTC)[reply]

What is SDD?[edit]

The article doesn't explain this acronym — Preceding unsigned comment added by 217.71.45.96 (talk) 06:23, 3 July 2014 (UTC)[reply]

Duplicate References[edit]

So, I didn't think to look at the references list before I cited the Dragon Book in my change. Anyone know how to remove the duplicate reference? Bekroogle (talk) 19:18, 3 November 2014 (UTC)[reply]

Syntax Directed Translation[edit]

Syntax Directed Translation also known as Syntax Driven Translation and Syntax Orianted. Is in simplest terms:

Syntax Directed Translation means driving the entire translation process with the syntax recognizer.

It means that some actions may be added to syntax parser rules. yacc has the ability to do so using { <action> } if I remember correctly. Note. actions are not necessarily added to every rule.

The concept originated in the early ACM SegPlan work of the 60's. Many early compilers were developed utilizing syntax directed strategies. The early Shorre Metacompilers (1963) and others used SDT strategies. Several are described in the book PROGRAMMING SYSTEMS & LANGUAGES Saul Rosen Professor Computer Science Purdue University McGraw-Hill Copyright 1967. Syntax Directed Compiling Pg 264 describe the earliest use of the term simply meant the syntax was coded in a grammar. In those days parsers were coded in assembly. There were no general languages available.

Several early syntax driven compilers are described in that nook.

META I and META II were debeloped in the early 60's. Papers on META II apearing in 1964.

META I was used to initially compile META II. META II was able to compile a subset of ALGOL. META II used a reductive parsing language with embedded out prodiction. The parser left recognized tokens on a stack that the output productions referenced relative to the top stack entry. All were character strings. The output code was assembly for a pseudo stack machine.

TREE META removed the grammar language output constructs, replacing them with tree building operators. The TREE META grammar directly produced an abstract syntax tree. A special operator caused an unparse rule to be called. Unparse rules recognize tree patterns. When recognized the rule action is executed to output code. Action code can call unparse rules. TREE META allowed simple optimizations to be performed.

CWIC developed around 1970 changed the unparse rules and calling method. In CWIC they were called generators. A named generator was a set of unparse rules actions. Generators could be called from an unparse rulr, action or a syntax rule.

These languages are truly syntax driven compilers. Actions are only on some grammar rules. Not ever one. Some rules are simply drivers for others. An arithmetic expression grammar for example:

expr = term $(('+':ADD | '-':SUB) term!2);
term = factor $(('*':MPY|'/':DIV) factor!2);
factor = id | number | '(' expr ')';

The parser pseudo machine has three stacks. The call stack keeping the return location from a rule function. The node stack holds nodes placed on it by the :<node name> operator. They are removed by the !<number> tree building operator. the number parameter to the tree operator specifies a number of parse stakes to remove from the parse stack. The removrd entries along with the node are placed in a created list and the list pushed on the parse stack. The list can be described as a tree or a polish prefix list notation.

The point is that the factor rule above is pure grammar. There are to production elements expressed there on.

Syntax Directed translation has been used to break up compilations into small blocks of code that can be handled within the memory limits of computers the translator is running on.

Steamerandy (talk) 08:42, 14 February 2015 (UTC)[reply]

Confused by this paragrapl[edit]

I know what is ment to be explained. But this is wrong and confusing to a layperson.

Each symbol in the grammar can have an attribute, 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 symbol X, with an attribute t, that attribute is referred to as X.t

How does this attribute reference work. How can one know that a symbol of the program is X beforehand.

That is: X may be a symbol of the compiler that is a pointer to a symbol in the symbol table. The actual symbol of interest belongs to the program being compiled and may be any valid parsed symbol string. There are various ways of implanting symbol attributes. A symbol table entry may be a structure like in the c or c++ languages. Attributes may be held in an associative list. Or a combination of fixed attributeso and dynamic associated lists. In the article X may in fact reference a symbol in a symbol dictionary or table. But X is a symbol in the compiler program. A layperson would be confused. Steamerandy (talk) 04:03, 28 June 2015 (UTC)[reply]

Copyright problem removed[edit]

Prior content in this article duplicated one or more previously published sources. The material was copied from: https://tajseer.files.wordpress.com/2014/06/alsudragonbook.pdf. Copied or closely paraphrased material has been rewritten or removed and must not be restored, unless it is duly released under a compatible license. (For more information, please see "using copyrighted works from others" if you are not the copyright holder of this material, or "donating copyrighted materials" if you are.)

For legal reasons, we cannot accept copyrighted text or images borrowed from other web sites or published material; such additions will be deleted. Contributors may use copyrighted publications as a source of information, and, if allowed under fair use, may copy sentences and phrases, provided they are included in quotation marks and referenced properly. The material may also be rewritten, providing it does not infringe on the copyright of the original or plagiarize from that source. Therefore, such paraphrased portions must provide their source. Please see our guideline on non-free text for how to properly implement limited quotations of copyrighted text. Wikipedia takes copyright violations very seriously, and persistent violators will be blocked from editing. While we appreciate contributions, we must require all contributors to understand and comply with these policies. Thank you. Justlettersandnumbers (talk) 23:13, 8 February 2017 (UTC)[reply]