File: metaModuleCacheJune2018.maude

package info (click to toggle)
maude 3.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,480 kB
  • sloc: cpp: 133,192; makefile: 2,180; yacc: 1,984; sh: 1,373; lex: 886
file content (64 lines) | stat: -rw-r--r-- 1,317 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
set show timing off .
set show advisories off .

***
***	Check that the meta-interpreter doesn't use the meta-module cache.
***

fmod FOO is
  sort Foo .
  ops a b : -> Foo .
  eq a = b .
endfm

load metaInterpreter 

mod TEST is
  pr META-INTERPRETER .
  op me : -> Oid .
  op User : -> Cid .
  op state:_ : Nat -> Attribute .

  vars X Y Z : Oid .

  rl < X : User | state: 0 > createdInterpreter(X, Y, Z) =>
     < X : User | state: 1 > insertModule(Z, X, foo) .

  rl < X : User | state: 1 > insertedModule(X, Y) =>
     < X : User | state: 2 > insertModule(Y, X, bar) .

  rl < X : User | state: 2 > insertedModule(X, Y) =>
     < X : User | state: 3 > reduceTerm(Y, X, 'BAR, 'a.Foo) .

  op foo : -> Module .
  eq foo = (
fmod 'FOO is
  nil
  sorts 'Foo .
  none
  op 'a : nil -> 'Foo [none] .
  op 'c : nil -> 'Foo [none] .
  none
  eq 'a.Foo = 'c.Foo [none] .
endfm ) .

  op bar : -> Module .
  eq bar = (
fmod 'BAR is
  protecting 'FOO .
  sorts none .
  none
  none
  none
  none
endfm ) .
endm

*** correct result
erew  <> < me : User | state: 0 > createInterpreter(interpreterManager, me, none) .

*** put a fmod BAR with same meta-syntax but different semantics in cache
red metaReduce(bar, 'a.Foo) .

*** wrong result
erew  <> < me : User | state: 0 > createInterpreter(interpreterManager, me, none) .