rlsrunner and krunner linking rascal with k for program
play

RLSRunner and KRunner: Linking Rascal with K for Program Analysis - PowerPoint PPT Presentation

RLSRunner and KRunner: Linking Rascal with K for Program Analysis and Execution Mark Hills, Paul Klint, & Jurgen J. Vinju 2nd International Workshop on the K Framework and its Applications August 9, 2011 Cheile Gradistei, Romania Thursday,


  1. RLSRunner and KRunner: Linking Rascal with K for Program Analysis and Execution Mark Hills, Paul Klint, & Jurgen J. Vinju 2nd International Workshop on the K Framework and its Applications August 9, 2011 Cheile Gradistei, Romania Thursday, June 21, 2012

  2. Overview 2 Thursday, June 21, 2012

  3. Overview •Motivation 2 Thursday, June 21, 2012

  4. Overview •Motivation •Tool components: Rascal 2 Thursday, June 21, 2012

  5. Overview •Motivation •Tool components: Rascal •Tool components: K 2 Thursday, June 21, 2012

  6. Overview •Motivation •Tool components: Rascal •Tool components: K •Demo 2 Thursday, June 21, 2012

  7. Overview •Motivation •Tool components: Rascal •Tool components: K •Demo •Wrap-up 2 Thursday, June 21, 2012

  8. Motivation: Why This Tool? 3 Thursday, June 21, 2012

  9. Motivation: Why This Tool? •Many K and K in Maude specifications exist -- want reuse 3 Thursday, June 21, 2012

  10. Motivation: Why This Tool? •Many K and K in Maude specifications exist -- want reuse •Integrating with graphical environments currently ad-hoc, bad user experience 3 Thursday, June 21, 2012

  11. Motivation: Why This Tool? •Many K and K in Maude specifications exist -- want reuse •Integrating with graphical environments currently ad-hoc, bad user experience •Want a general method to integrate these specifications with Rascal-based IDEs 3 Thursday, June 21, 2012

  12. Motivation: Why This Tool? •Many K and K in Maude specifications exist -- want reuse •Integrating with graphical environments currently ad-hoc, bad user experience •Want a general method to integrate these specifications with Rascal-based IDEs •(Personal) Wanted something like this all during my PhD 3 Thursday, June 21, 2012

  13. How Should it Work (RLSRunner)? 4 Thursday, June 21, 2012

  14. How Should it Work (RLSRunner)? 4 Thursday, June 21, 2012

  15. How Should it Work (RLSRunner)? 4 Thursday, June 21, 2012

  16. How Should it Work (RLSRunner)? 4 Thursday, June 21, 2012

  17. How Should it Work (RLSRunner)? 4 Thursday, June 21, 2012

  18. How Should it Work (RLSRunner)? 4 Thursday, June 21, 2012

  19. How Should it Work (KRunner)? 5 Thursday, June 21, 2012

  20. An Introduction to Rascal •Rascal: A meta-programming language for source code analysis and transformation •Based on concepts learned from ASF+SDF , but with a more traditional programming language feel •Features: parsing, structured control flow, rich data types (algebraic data types, lists, sets, tuples, maps, relations, etc), pattern matching, enumerations, higher order functions, etc 6 Thursday, June 21, 2012

  21. Defining Grammars in Rascal 7 Thursday, June 21, 2012

  22. Tool Components: Rascal (ShellExec) Rascal PID pid = createProcess(maudeLocation.path); writeTo(pid, toRun); res = readFrom(pid); killProcess(pid); 8 Thursday, June 21, 2012

  23. Tool Components: Rascal (ResourceMarkers) Rascal data Message = error(str msg, loc at) | warning(str msg, loc at) | info(str msg, loc at); Rascal import Message; public void java removeMessageMarkers(loc resourceLoc); public void java addMessageMarkers(set[Message] markers); 9 Thursday, June 21, 2012

  24. Tool Components: Rascal (RLSRunner ADT) Rascal data RLSRunner = RLSRun(loc maudeFile, str(str,list[str]) pre, RLSResult(str) post); 10 Thursday, June 21, 2012

  25. Tool Components: Rascal (Maude-ifier) Rascal if ((Program)`<Decl* decls> <FunDecl+ funDecls>` := p) return located(p,"Pgm", "__(<showDecls([d|d<-decls])>, <showFunDecls({f|f<-funDecls})>)"); Rascal syntax Program = Default: Decl* decls FunDecl+ funDecls; 11 Thursday, June 21, 2012

  26. Tool Components: Rascal (Returning Results) Rascal data RLSResult = SILFAnalysisResult(bool foundErrors, set[Message] messages) ; Rascal void exec(Tree pt, loc l) { str pgm = maudeify(pt, true, policy); RLSRunner rlsRunner = RLSRun(silfSpec, pre, post); RLSResult res = runRLSTask(maudeExec, rlsRunner, pgm); if (SILFAnalysisResult(true,msgs) := res) addMessageMarkers(msgs); } 12 Thursday, June 21, 2012

  27. Tool Components: Rascal (Generate Program Files) Rascal public str generateProgramModule(Tree pgm, str topSort, str pgmName, str pgmMod, str syntaxMod) { set[str] identifiers = { "<id>" | /Id id <- pgm } - "main"; str identifierListing = "syntax Id ::= <intercalate(" | ", [i|i<-identifiers]) > "; str pgmDeclaration = "syntax <topSort> ::= <pgmName>"; return "kmod <pgmMod> is including <syntaxMod> '<identifierListing> '<pgmDeclaration> ' 'macro <pgmName> = ' <pgm> ' 'endkm '"; } 13 Thursday, June 21, 2012

  28. Tool Components: K (Rascal Source Locations) K/Maude fmod RASCAL-LOCATION is including STRING . including INT . sort RLocation . op sl : String Int Int Int Int Int Int -> RLocation . endfm 14 Thursday, June 21, 2012

  29. Tool Components: K (Location Semantics) K/Maude op currLoc : RLocation -> State [format (r! o)] . op rloc : RLocation -> ComputationItem . eq k(rloc(RL) -> K) currLoc(RL') = k(K) currLoc(RL) . eq k(exp(locatedExp(E, RL)) -> K) currLoc(RL') = k(exp(E) -> rloc(RL') -> K) currLoc(RL) . 15 Thursday, June 21, 2012

  30. Tool Components: K (Generating Results) K/Maude op makeAnalysisMsg : OutputList -> String . eq makeAnalysisMsg(warning(level(1) msgloc(RL) msg(S) WIS), OL) = ("||1:::" + rloc2str(RL) + ":::" + S + "||") + makeAnalysisMsg(OL) . 16 Thursday, June 21, 2012

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