implementation of a compiler from pluscal to tla with tom
play

Implementation of a compiler from Pluscal to TLA+ with Tom Marc - PowerPoint PPT Presentation

Environement Pesonal work Current situation Implementation of a compiler from Pluscal to TLA+ with Tom Marc PINHEDE ESIAL-Telecom Nancy 1 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom Environement Pesonal


  1. Environement Pesonal work Current situation Implementation of a compiler from Pluscal to TLA+ with Tom Marc PINHEDE ESIAL-Telecom Nancy 1 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  2. Environement Pesonal work Current situation Contents I Environement Pluscal2.0 TLA+ Tools II Personal work Grammars Tree rewriting Code Generation III Situation after the internship Tests Todo 2 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  3. Environement Pesonal work Current situation Introduction Location: Loria Team: AlGorille Supervisor: Martin Quinson Task: Rework on a thesis compiler Subject: Compiler form Pluscal2.0 to TLA+ 3 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  4. Environement Pesonal work Current situation Introduction Situation: TLA+, a language used to specify a system : Very mathematical specification Permit to use a model-checker But not an easy language to learn, for program designers. Leslie Lamport introduced Pluscal. But it was still not really easy to use. 4 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  5. Environement Pesonal work Current situation Pluscal2.0 Syntax close to standard algorithms Procedures can be used Non typed variables Accept processes and hierarchical processes Atomicity for some part of code accepted Embedded TLA+ code 5 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  6. Environement Pesonal work Current situation Pluscal2.0 code algorithm Peterson extends Naturals constants numPeers (* Number of processes *) variables lockReq = [id \in Node |-> FALSE], turn = 1, (* tie-break variable *) count = 0 (* number of processes holding the lock *) fair process Node[numPeers] definition other == CHOOSE id \in Node : id # self 6 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  7. Environement Pesonal work Current situation Pluscal2.0 code begin ncs: loop skip; lockReq[self] := TRUE; turn := other; try: when ~lockReq[other] \/ turn = self; cs: count := count + 1; leave: count := count - 1; lockReq[self] := FALSE; end loop; 7 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  8. Environement Pesonal work Current situation Pluscal2.0 code end process; (*No Main process*) (* Assert: at most one process have the lock *) invariant count <= 1 (* Liveness: each requested lock is eventually granted *) temporal \A p \in Node: [] (<> lockReq[p]) (* Instantiating the model for 2 processes *) constants numPeers = 2 8 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  9. Environement Pesonal work Current situation TLA+ Set of Actions Action : Guard conditions Variable modifications List of unchanged variables Special actions that ensure liveness properties 9 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  10. Environement Pesonal work Current situation TLA+ code ---------------MODULE HourClock----------------------- EXTENDS Naturals VARIABLE hr HCini == hr \in (1..12) HCnxt == hr’ = IF hr # 12 THEN hr+1 ELSE 1 HC == HCini /\ [][HCnxt]_hr ------------------------------------------------------ THEOREM HC => []HCini Vrai == hr # 13 Faux == hr # 7 ====================================================== 10 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  11. Environement Pesonal work Current situation Outils Main tools: Tom: Language extension. Permit easy tree manipulations. Antlr: Automatic Parser/Lexer generator. Others: Text editor, TlaToolbox,Tlc... 11 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  12. Environement Pesonal work Current situation Grammars Grammars are divided in two set: one for Pluscal2.0, the other for TLA+ For each set, two grammars. The antlr version and the Tom version. Four files: Antlr grammar for Pluscal2.0 Antlr grammar for TLA+ Gom signature for Pluscal2.0 Gom signature for TLA+ 12 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  13. Environement Pesonal work Current situation Tree rewriting Tree rewriting are executed by tom. Two tools: match: Applied on a piece of the tree. strategy: Applied on the whole tree. Exemple: visit LabeledStatement{ /* Add label to any loop statement.*/ Labellisation(EmptyLabel(),Loop(labeledStatementList))-> { return ‘Labellisation(GivenLabel(OptionString("loop", ConcOption())),Loop(labeledStatementList)); } } 13 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  14. Environement Pesonal work Current situation Rewriting steps 14 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  15. Environement Pesonal work Current situation Code generation Use of a ’pretty printer’ Recursive walk of the tree Two output files (.tla et .cfg) Completed step for the actual TLA+ signature 15 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  16. Environement Pesonal work Current situation Tests Approach close to the TDD (Test-Driven Development) used. Set of tests, divided in subset, available Tests identify working instructions. Scripted tests with recorded answers. 16 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  17. Environement Pesonal work Current situation Test of the whole compiler Implementation of a simple test requiring every steps of the compiler Test accepeted by the model-checker Verification of trivial properties validated 17 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  18. Environement Pesonal work Current situation Unfinished parts Semantic control Normalization for some instructions Potential add of a separate step to manage the PC value or Translator completion. Add of new features to the compiler 18 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  19. Environement Pesonal work Current situation Conclusion For the compiler: Use of traditional tools and separation of the work in steps to make sources more accessible Completed main process Some steps need to be completed or extended. As a personnal experience: Rewarding intership and good approach of the research world New tools and new way to program discovered Management and teamwork pleasant 19 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  20. Environement Pesonal work Current situation Sources V´ erification Formelle d’Algorithmes Distribu´ es en PlusCal-2 - Sabina AKHTAR Specifying Systems - Leslie Lamport A Pluscal User’s Manual - Leslie Lamport 20 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

  21. Environement Pesonal work Current situation Thanks Thanks to: Martin QUINSON, my intership supervisor, for his presence and control, but also for the good atmosphere he was able to create in the team. Stephan MERTZ, for helping me to understand the potential of this project. Jean-Christophe BACH, for his help and patience with Tom. 21 / 21 Marc PINHEDE Implementation of a compiler from Pluscal to TLA+ with Tom

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend