rlsrunner linking rascal with k for program analysis
play

RLSRunner: Linking Rascal with K for Program Analysis Mark Hills, - PowerPoint PPT Presentation

RLSRunner: Linking Rascal with K for Program Analysis Mark Hills, Paul Klint, & Jurgen J. Vinju 4th International Conference on Software Language Engineering July 4, 2011 Braga, Portugal Thursday, June 21, 2012 Some Quick Definitions


  1. RLSRunner: Linking Rascal with K for Program Analysis Mark Hills, Paul Klint, & Jurgen J. Vinju 4th International Conference on Software Language Engineering July 4, 2011 Braga, Portugal Thursday, June 21, 2012

  2. Some Quick Definitions • Rascal: A meta-programming language for source code analysis and transformation • K: A semantic framework, based on concepts from rewriting logic (a logic of concurrency) and term rewriting • Maude: A language and execution engine for rewriting logic specifications 2 Thursday, June 21, 2012

  3. Overview 3 Thursday, June 21, 2012

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

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

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

  7. Overview • Motivation • Tool components: Rascal • Tool components: K • Demo 3 Thursday, June 21, 2012

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

  9. Motivation: Why This Tool? 4 Thursday, June 21, 2012

  10. Motivation: Why This Tool? • Many K and K in Maude specifications exist -- want reuse 4 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 4 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 4 Thursday, June 21, 2012

  13. 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 4 Thursday, June 21, 2012

  14. How Should it Work? 5 Thursday, June 21, 2012

  15. How Should it Work? 5 Thursday, June 21, 2012

  16. How Should it Work? 5 Thursday, June 21, 2012

  17. How Should it Work? 5 Thursday, June 21, 2012

  18. How Should it Work? 5 Thursday, June 21, 2012

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

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

  21. 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); 7 Thursday, June 21, 2012

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

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

  24. Tool Components: Rascal (Returning Results) data RLSResult = SILFAnalysisResult(bool foundErrors, Rascal set[Message] messages) ; void exec(Tree pt, loc l) { Rascal 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); } 10 Thursday, June 21, 2012

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

  26. Tool Components: K (Location Semantics) op currLoc : RLocation -> State [format (r! o)] . K/Maude 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) . 12 Thursday, June 21, 2012

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

  28. Demo 14 Thursday, June 21, 2012

  29. Future Work • Support other execution features: standard execution, model checking, state space search • Automatic generation of Maude-ifier and Maude operator defs for abstract syntax • Support C Policy Framework 15 Thursday, June 21, 2012

  30. Wrap-Up • RLSRunner provides a reusable library for running Maude-based K definitions • Per-language requirements light (outside of maude- ifier), leverage library • K specifications require minimal modifications • Provides a template for integrating other console apps with Rascal 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