Skip to content

Commit

Permalink
Extend #getImportedModules to recurse through modules
Browse files Browse the repository at this point in the history
  • Loading branch information
nishantjr committed Jul 2, 2019
1 parent 85c1a58 commit d51a077
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/kink.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ module META-ACCESSORS
imports BOOL
imports SET
syntax Set ::= #getImportedModules(ModuleName) [function]
syntax Set ::= #getImportedModulesSet(ModuleName, Set) [function]
rule #getImportedModules(MNAME) => #getImportedModulesSet(MNAME, SetItem(MNAME))
rule [[ #getImportedModulesSet(MNAME, MODS)
=> #getImportedModulesSet(MNAME, MODS SetItem(IMPORTED) #getImportedModules(IMPORTED))
]]
<name> MNAME </name>
<decl> koreImport(IMPORTED, _) </decl>
requires notBool IMPORTED in MODS
rule #getImportedModulesSet(MNAME, MODS) => MODS [owise]
```

```k
syntax Bool ::= #isSortDeclared(ModuleName, SortName) [function, withConfig]
rule [[ #isSortDeclared(MNAME:ModuleName, SORT:SortName) => true ]]
<name> MNAME </name>
Expand All @@ -105,11 +118,19 @@ module META-ACCESSORS
```

```k
syntax Bool ::= #isSymbolDeclared(ModuleName, SymbolName) [function, withConfig]
rule [[ #isSymbolDeclared(MNAME, SYMBOL) => true ]]
syntax Bool ::= #isSymbolDeclaredSingleModule(ModuleName, SymbolName) [function]
rule [[ #isSymbolDeclaredSingleModule(MNAME, SYMBOL) => true ]]
<name> MNAME </name>
<decl> (symbol SYMBOL { _ } ( _ ) : _ ATTRS) </decl>
rule #isSymbolDeclared(_, _) => false [owise]
rule #isSymbolDeclaredSingleModule(_, _) => false [owise]
syntax Bool ::= #isSymbolDeclared(ModuleName, SymbolName) [function]
syntax Bool ::= #isSymbolDeclaredSet(Set, SymbolName) [function]
rule #isSymbolDeclared(MNAME, SNAME)
=> #isSymbolDeclaredSet(#getImportedModules(MNAME), SNAME)
rule #isSymbolDeclaredSet(SetItem(M) Ms, SNAME)
=> #isSymbolDeclaredSingleModule(M, SNAME) orBool #isSymbolDeclaredSet(Ms, SNAME)
rule #isSymbolDeclaredSet(.Set, SNAME) => false
```

```k
Expand Down

0 comments on commit d51a077

Please sign in to comment.