CS 3304: Comparative Languages
Semantics
[
Course Documents
] : [
Semantics
]
Previous
Contents
Next
Keyword Index
Static Semantics
CFGs cannot describe all of the syntax of programming languages--context-specific parts are left out
Static semantics refers to type checking and resolving declarations; has nothing to do with "meaning" in the sense of run-time behavior
Often described using an
attribute grammar
(AG) (Knuth, 1968)
Basic idea: add to CFG by carrying some semantic information along inside parse tree nodes
Primary value of AGs:
Static semantics specification
Compiler design (static semantics checking)