the k framework and a formal semantics of c
play

The K Framework and a Formal Semantics of C Chucky Ellison Traian - PowerPoint PPT Presentation

The K Framework Semantics of C The K Framework and a Formal Semantics of C Chucky Ellison Traian Florin S , erb anut , a Grigore Ros , u University of Illinois MVD10 September 17, 2010 MVD10 Chucky Ellison The K Framework and


  1. The K Framework Semantics of C The K Framework and a Formal Semantics of C Chucky Ellison Traian Florin S , erb˘ anut , ˘ a Grigore Ros , u University of Illinois MVD’10 September 17, 2010 MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 1/13

  2. The K Framework Overview Semantics of C Example What is K? ◮ K is an executable semantic framework for defining programming languages, calculi, type systems, and formal analysis tools MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 2/13

  3. The K Framework Overview Semantics of C Example What is K? ◮ K is an executable semantic framework for defining programming languages, calculi, type systems, and formal analysis tools ◮ It has been used to define: MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 2/13

  4. The K Framework Overview Semantics of C Example What is K? ◮ K is an executable semantic framework for defining programming languages, calculi, type systems, and formal analysis tools ◮ It has been used to define: Languages Functional, Imperative, OO, Declarative; including Verilog, Scheme, Java, and now C MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 2/13

  5. The K Framework Overview Semantics of C Example What is K? ◮ K is an executable semantic framework for defining programming languages, calculi, type systems, and formal analysis tools ◮ It has been used to define: Languages Functional, Imperative, OO, Declarative; including Verilog, Scheme, Java, and now C Type Systems Checkers, Inferencers; including W MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 2/13

  6. The K Framework Overview Semantics of C Example What is K? ◮ K is an executable semantic framework for defining programming languages, calculi, type systems, and formal analysis tools ◮ It has been used to define: Languages Functional, Imperative, OO, Declarative; including Verilog, Scheme, Java, and now C Type Systems Checkers, Inferencers; including W Algorithms Sorting, Dijkstra’s Algorithm, Sudoku Solving MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 2/13

  7. The K Framework Overview Semantics of C Example What is K? ◮ K is an executable semantic framework for defining programming languages, calculi, type systems, and formal analysis tools ◮ It has been used to define: Languages Functional, Imperative, OO, Declarative; including Verilog, Scheme, Java, and now C Type Systems Checkers, Inferencers; including W Algorithms Sorting, Dijkstra’s Algorithm, Sudoku Solving Tools Debugging, Race Detection MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 2/13

  8. The K Framework Overview Semantics of C Example What is K? ◮ K is an executable semantic framework for defining programming languages, calculi, type systems, and formal analysis tools ◮ It has been used to define: Languages Functional, Imperative, OO, Declarative; including Verilog, Scheme, Java, and now C Type Systems Checkers, Inferencers; including W Algorithms Sorting, Dijkstra’s Algorithm, Sudoku Solving Tools Debugging, Race Detection Logics Matching Logic MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 2/13

  9. The K Framework Overview Semantics of C Example The K Technique T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result ◮ Flexible, extensible, configurations as multi-sets of nested cells MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 3/13

  10. The K Framework Overview Semantics of C Example The K Technique T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result ◮ Flexible, extensible, configurations as multi-sets of nested cells ◮ Cells can contain (multi-)sets, lists, maps, or computations MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 3/13

  11. The K Framework Overview Semantics of C Example The K Technique T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result ◮ Flexible, extensible, configurations as multi-sets of nested cells ◮ Cells can contain (multi-)sets, lists, maps, or computations ◮ Computation (K) as a list of � -separated tasks MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 3/13

  12. The K Framework Overview Semantics of C Example The K Technique T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result ◮ Flexible, extensible, configurations as multi-sets of nested cells ◮ Cells can contain (multi-)sets, lists, maps, or computations ◮ Computation (K) as a list of � -separated tasks ◮ Next task always at top of the list MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 3/13

  13. The K Framework Overview Semantics of C Example The K Technique T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result ◮ Flexible, extensible, configurations as multi-sets of nested cells ◮ Cells can contain (multi-)sets, lists, maps, or computations ◮ Computation (K) as a list of � -separated tasks ◮ Next task always at top of the list ◮ Easy to define control-intensive features like halt, call/cc MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 3/13

  14. The K Framework Overview Semantics of C Example The K Technique T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result ◮ Flexible, extensible, configurations as multi-sets of nested cells ◮ Cells can contain (multi-)sets, lists, maps, or computations ◮ Computation (K) as a list of � -separated tasks ◮ Next task always at top of the list ◮ Easy to define control-intensive features like halt, call/cc ◮ Rewriting modulo ACI (associativity, commutivity, identity) to improve modularity MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 3/13

  15. The K Framework Overview Semantics of C Example The K Technique T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result ◮ Flexible, extensible, configurations as multi-sets of nested cells ◮ Cells can contain (multi-)sets, lists, maps, or computations ◮ Computation (K) as a list of � -separated tasks ◮ Next task always at top of the list ◮ Easy to define control-intensive features like halt, call/cc ◮ Rewriting modulo ACI (associativity, commutivity, identity) to improve modularity ◮ Specify only what is needed from a cell for a semantic rule MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 3/13

  16. The K Framework Overview Semantics of C Example The K Technique T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result ◮ Flexible, extensible, configurations as multi-sets of nested cells ◮ Cells can contain (multi-)sets, lists, maps, or computations ◮ Computation (K) as a list of � -separated tasks ◮ Next task always at top of the list ◮ Easy to define control-intensive features like halt, call/cc ◮ Rewriting modulo ACI (associativity, commutivity, identity) to improve modularity ◮ Specify only what is needed from a cell for a semantic rule ◮ Abstract the remainder of the cell MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 3/13

  17. The K Framework Overview Semantics of C Example IMP Syntax AExp ::= Int | VarId | AExp + AExp [ strict ] [ strict ] | AExp / AExp BExp ::= Bool [ seqstrict ] | AExp <= AExp not BExp [ strict ] | [ strict ( 1 )] | BExp and BExp Stmt ::= skip | Stmt ; Stmt [ strict ( 2 )] | VarId := AExp if BExp then Stmt else Stmt [ strict ( 1 )] | | while BExp do Stmt [ strict ] | print AExp | var VarId ; Stmt MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 4/13

  18. The K Framework Overview Semantics of C Example Assignment Rule Configuration T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result Variable Lookup Rule � X · · · � k �· · · X �→ L · · · � env �· · · L �→ V · · · � store V MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 5/13

  19. The K Framework Overview Semantics of C Example IMP Semantics T store threads Map{Location,KResult} thread* nextLoc env Nat k K Map{VarId,Location} output List{KResult} result Assignment � X := V · · · � k �· · · X �→ L · · · � env �· · · L �→ · · · � store · V Print (Output) � print V · · · � k �· · · · � output V MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 6/13

  20. The K Framework Overview Semantics of C Example The K Framework Overview Example Semantics of C Background Results MVD’10 Chucky Ellison The K Framework and a Formal Semantics of C 7/13

Recommend


More recommend