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

rlsrunner linking rascal with k for program analysis
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 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

slide-2
SLIDE 2

Some Quick Definitions

  • Rascal: A meta-programming

language for source code analysis and transformation

  • K: A semantic framework, based
  • n 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

slide-3
SLIDE 3

Overview

3

Thursday, June 21, 2012

slide-4
SLIDE 4

Overview

  • Motivation

3

Thursday, June 21, 2012

slide-5
SLIDE 5

Overview

  • Motivation
  • Tool components: Rascal

3

Thursday, June 21, 2012

slide-6
SLIDE 6

Overview

  • Motivation
  • Tool components: Rascal
  • Tool components: K

3

Thursday, June 21, 2012

slide-7
SLIDE 7

Overview

  • Motivation
  • Tool components: Rascal
  • Tool components: K
  • Demo

3

Thursday, June 21, 2012

slide-8
SLIDE 8

Overview

  • Motivation
  • Tool components: Rascal
  • Tool components: K
  • Demo
  • Wrap-up

3

Thursday, June 21, 2012

slide-9
SLIDE 9

Motivation: Why This Tool?

4

Thursday, June 21, 2012

slide-10
SLIDE 10

Motivation: Why This Tool?

  • Many K and K in Maude specifications exist -- want

reuse

4

Thursday, June 21, 2012

slide-11
SLIDE 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

slide-12
SLIDE 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

slide-13
SLIDE 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

slide-14
SLIDE 14

How Should it Work?

5

Thursday, June 21, 2012

slide-15
SLIDE 15

How Should it Work?

5

Thursday, June 21, 2012

slide-16
SLIDE 16

How Should it Work?

5

Thursday, June 21, 2012

slide-17
SLIDE 17

How Should it Work?

5

Thursday, June 21, 2012

slide-18
SLIDE 18

How Should it Work?

5

Thursday, June 21, 2012

slide-19
SLIDE 19

How Should it Work?

5

Thursday, June 21, 2012

slide-20
SLIDE 20

Tool Components: Rascal (ShellExec)

PID pid = createProcess(maudeLocation.path); writeTo(pid, toRun); res = readFrom(pid); killProcess(pid);

6

Rascal

Thursday, June 21, 2012

slide-21
SLIDE 21

Tool Components: Rascal (ResourceMarkers)

7

import Message; public void java removeMessageMarkers(loc resourceLoc); public void java addMessageMarkers(set[Message] markers); data Message = error(str msg, loc at) | warning(str msg, loc at) | info(str msg, loc at);

Rascal Rascal

Thursday, June 21, 2012

slide-22
SLIDE 22

Tool Components: Rascal (RLSRunner ADT)

8

data RLSRunner = RLSRun(loc maudeFile, str(str,list[str]) pre, RLSResult(str) post);

Rascal

Thursday, June 21, 2012

slide-23
SLIDE 23

Tool Components: Rascal (Maude-ifier)

9

if ((Program)`<Decl* decls> <FunDecl+ funDecls>` := p) return located(p,"Pgm", "__(<showDecls([d|d<-decls])>, <showFunDecls({f|f<-funDecls})>)"); syntax Program = Default: Decl* decls FunDecl+ funDecls;

Rascal Rascal

Thursday, June 21, 2012

slide-24
SLIDE 24

Tool Components: Rascal (Returning Results)

data RLSResult = SILFAnalysisResult(bool foundErrors, set[Message] messages) ;

10

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); }

Rascal Rascal

Thursday, June 21, 2012

slide-25
SLIDE 25

Tool Components: K (Rascal Source Locations)

fmod RASCAL-LOCATION is including STRING . including INT . sort RLocation .

  • p sl : String Int Int Int Int Int Int -> RLocation .

endfm

11

K/Maude

Thursday, June 21, 2012

slide-26
SLIDE 26

Tool Components: K (Location Semantics)

12

  • p currLoc : RLocation -> State [format (r! o)] .
  • p 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) .

K/Maude

Thursday, June 21, 2012

slide-27
SLIDE 27

Tool Components: K (Generating Results)

13

  • p makeAnalysisMsg : OutputList -> String .

eq makeAnalysisMsg(warning(level(1) msgloc(RL) msg(S) WIS), OL) = ("||1:::" + rloc2str(RL) + ":::" + S + "||") + makeAnalysisMsg(OL) .

K/Maude

Thursday, June 21, 2012

slide-28
SLIDE 28

Demo

14

Thursday, June 21, 2012

slide-29
SLIDE 29

Future Work

  • Support other execution features: standard execution,

model checking, state space search

  • Automatic generation of Maude-ifier and Maude
  • perator defs for abstract syntax
  • Support C Policy Framework

15

Thursday, June 21, 2012

slide-30
SLIDE 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