Chapter-1 PP 2 - Merged
Chapter-1 PP 2 - Merged
Concepts of Programming
Languages, Robert W.
Sebesta, (10th edition),
Addison-Wesley Publishing
Company
<stmt> → <single_stmt>
| begin <stmt_list> end
<stmts> → <stmt> |
<stmt> ; <stmts> => <var> = <expr>
<var> → a | b | c | d
=> a = <term> + <term>
<expr> → <term> + <term> |
<term> - <term> => a = <var> + <term>
=> a = b + const
Programming Paradigms-425 CCS 18
An Example Derivation
<program> => <stmts> => <stmt>
=> <var> = <expr>
=> a = <expr>
=> a = <term> + <term>
=> a = <var> + <term>
=> a = b + <term>
=> a = b + const
<expr>.actual_type ← <var>[1].actual_type
<expr>.actual_type =? <expr>.expected_type
• Operational Semantics
– Describe the meaning of a program by executing
its statements on a machine, either simulated or
actual. The change in the state of the machine
(memory, registers, etc.) defines the meaning of
the statement
• To use operational semantics for a high-level
language, a virtual machine is needed