1 languages and compilers (sprog og oversættere) bent thomsen department of computer science...
TRANSCRIPT
1
Languages and Compilers(SProg og Oversættere)
Bent Thomsen
Department of Computer Science
Aalborg University
With acknowledgement to Hanne Riis Nielson and Flemming Nielson whose book this lecture is based on.
2
The missing link
The connectionBetween
Syntax and SemanticsAnd
Languages and Compilers
3
The Language While
The Language While can be considered mini version of Mini-TriangleWhile is almost the same as the BIMS language
4
Single step operational semantics for While
5
A stack based virtual machine - AM
States:
Transitions:
6
Operational semantics for AM
7
Translation of While to AM
Note similarity with code generation templates for Mini-Triangle
8
Example
9
Correctness Proof
10
Soundness and completeness
11
Getting closer to TAM
12
And closer
13
Conclusion
• With a bit of hard work it is possible to connect – The high level operational semantics for a language
– With the low level implementation
– And prove correctness of the translation
• This is called:
Provably correct implementations
• For more information read– Semantics with applications,
– Hanne Riis Nielson and Flemming Nielson
– Wiley 1992, ISBN 0 471 92980 8