Chapter 4 Flashcards

1
Q

To help in semantic analysis we need two tools

A

Semantic rules(definitions)
Semantic actions(translations)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Semantic analysis

A
  • checks the src program for semantic error
  • type checking
  • Example: Array indexing using floats
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Semantic analysis uses … from the syntax analysis

A

hierarchical structure to identify operators and operands

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Semantic analyzer judgment

A

Example: int a = “value”; is syntactically and lexically correct but semantic analyzer throws an error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Semantic analyzer tasks

A
  • Scope resolution
  • Type checking
  • Array bound checking
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Semantic errors

A
  • Type mismatch
  • Undeclared vars
  • Reserved identifier use
  • Multiple declaration of variable
  • Parameter and argument mismatch
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Syntax directed translation

A
  • refers to a method a compiler implementation where the source language translation is completely driven by the parser
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Syntax directed translation is directed by

A

Context free grammars

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Attributed grammars

A

Augment CFG with information to control semantic analysis and translation process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Steps in syntax directed translation

A

input string -> parse tree -> dependency graph -> eval of semantic rules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Output action of Syntax directed translation

A
  • computation of values for variable belonging to the compiler
  • generate of intermediate code
  • printing an error diagnostic
  • placement of values in table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Syntax directed definition

A

semantic rule in which each variable adds extra variable. And each production adds semantic rule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly