Download presentation
Presentation is loading. Please wait.
Published byQuinten Mellin Modified over 9 years ago
1
1 Languages and Compilers (SProg og Oversættere) Lecture 13 (2) 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
2 The missing link The connection between Syntax and Semantics and Languages and Compilers
3
3 The Language While The Language While can be considered a mini version of Mini Triangle While is almost the same as the BIMS language
4
4 Single step operational semantics for While
5
5 Recursive Interpreter and Semantics public Object visitBinaryExpression (BinaryExpression expr, Object arg){ Value val1 = (Value) expr.E1.visit(this, null); Value val2 = (Value) expr.E2.visit(this, null); return applyBinary(expr.O, val1, val2); } Code for Recursive Interpreter can be derived from big step semantics
6
6 A stack based virtual machine - AM States: Transitions:
7
7 Operational semantics for AM
8
8 Translation of While to AM Note similarity with code generation templates for Mini Triangle
9
9 Example
10
10 Correctness Proof
11
11 Soundness and completeness
12
12 Getting closer to TAM
13
13 And closer
14
14 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.