retagged by
582 views

1 Answer

Best answer
4 votes
4 votes

Well, in simple term, Syntax Analysis checks the Grammar (or the formation or the position) of the words in the sentence, while SDT (Syntax-Directed Translation) is more about Validating the sentence and performing the action, according to the grammar.

For example, check this.

int a = 10; // It is syntactically correct.
a = 10 int; // It is syntactically not correct, hence Syntax Analysis will give error.

/**** Now Chceck this ****/

bool a; // "a" is a boolean type of variable, I am assuming it allow
         // only two values "0" or "1"

a = 3; // According to our assumption in above line, this should give error
       // But this can not be detected if we do not have SDT, because syntax wise
       // it is a correct statement.

So basically, SDT is used to validate the syntax (not the structure but the meaning), While Syntax Analysis is used to check the structure of the statement. 

selected by

Related questions

1 votes
1 votes
1 answer
2
mystylecse asked Aug 15, 2017
425 views
Consider the following transition rules:A BCC >+BC | A | epsilionB DB{print '+';} | epsilionD (A)| id{print id.value;}On input ' 5+67 ', this translation schme will pr...
0 votes
0 votes
2 answers
3
Subhadeeppathak asked Nov 28, 2022
454 views
Attributes are said to be of two type, synthesised and inherited. What actually is an attribute? Why an attribute exist, how to define it?