Skip to content

Commit bc8a3ca

Browse files
committed
Add configuration variable $STARTSYM
1 parent e61b002 commit bc8a3ca

File tree

1 file changed

+6
-4
lines changed
  • kmir/src/kmir/kdist/mir-semantics

1 file changed

+6
-4
lines changed

kmir/src/kmir/kdist/mir-semantics/kmir.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module KMIR-SYNTAX
1616
imports INT-SYNTAX
1717
imports FLOAT-SYNTAX
1818
19-
syntax KItem ::= #init( Pgm, Symbol )
19+
syntax KItem ::= #init( Pgm )
2020
2121
////////////////////////////////////////////
2222
// FIXME things below related to memory and
@@ -73,7 +73,7 @@ module KMIR-CONFIGURATION
7373
locals:List) // return val, args, local variables
7474
7575
configuration <kmir>
76-
<k> #init($PGM:Pgm, symbol("main")) </k>
76+
<k> #init($PGM:Pgm) </k>
7777
<retVal> NoValue </retVal>
7878
<currentFunc> ty(-1) </currentFunc> // to retrieve caller
7979
// unpacking the top frame to avoid frequent stack read/write operations
@@ -92,6 +92,7 @@ module KMIR-CONFIGURATION
9292
// heap
9393
<memory> .Map </memory> // FIXME unclear how to model
9494
// FIXME where do we put the "GlobalAllocs"? in the heap, presumably?
95+
<start-symbol> $STARTSYM:String </start-symbol>
9596
</kmir>
9697
endmodule
9798
```
@@ -116,11 +117,12 @@ function map and the initial memory have to be set up.
116117

117118
```k
118119
// #init step, assuming a singleton in the K cell
119-
rule <k> #init(_Name:Symbol _Allocs:GlobalAllocs Functions:FunctionNames Items:MonoItems, FuncName)
120+
rule <k> #init(_Name:Symbol _Allocs:GlobalAllocs Functions:FunctionNames Items:MonoItems)
120121
=>
121-
#execFunction(#findItem(Items, FuncName), Functions)
122+
#execFunction(#findItem(Items, symbol(FuncName)), Functions)
122123
</k>
123124
<functions> _ => #mkFunctionMap(Functions, Items) </functions>
125+
<start-symbol> FuncName </start-symbol>
124126
```
125127

126128
The `Map` of `functions` is constructed from the lookup table of `FunctionNames`,

0 commit comments

Comments
 (0)