Questions relating to the K Framework, a framework for building new programming languages using a semantics first approach. https://github.com/kframework/k/
Questions tagged [kframework]
51 questions
2
votes
1 answer
Cannot compute least sort of term (where the terms are lists)
I have the following productions:
syntax Id
syntax Exp ::= Id
syntax Exps ::= List{Exp, ","}
syntax Ids ::= List{Id, ","}
What does this error mean?
[Error] Critical: Cannot compute least sort of term:
_,__KOOL-UNTYPED-SYNTAX(Id(#"x"),,…

nishantjr
- 1,788
- 1
- 15
- 39
2
votes
1 answer
Difference between "requires" and "when" side conditions
For instance if I have some rule rule foo bar => baz bars and I only want to heat the rule when bar is in my list bars I believe I would add either requires bar in bars or when bar in bars. I've been using when as my…

ALee
- 25
- 1
- 6
2
votes
0 answers
K Framework produces an error in the OCaml backend
I am using the K semantics Framework and running tutorials
this is my TEST1.k :
module TEST1-SYNTAX
import DOMAINS
syntax Fun ::= "add(" Pgm "," Pgm ")" [strict]
syntax Pgm ::= Int
| Fun
endmodule
module TEST1
import…

Mohsen Rahnamaei
- 401
- 1
- 3
- 15
1
vote
1 answer
Inner Parser: Scanner Error: Numeric Argument to substrString
I'm working on lesson 10 of the K introduction. Can't figure out an error I'm getting. I have the file lesson-10.k with the following contents (simplified for now to demonstrate the error):
module LESSON-10
imports STRING
syntax String ::=…

Colm Bhandal
- 3,343
- 2
- 18
- 29
1
vote
2 answers
How do I make an item optional or repeatable in K syntax rule?
How can I convert this EBNF rules below with K Framework ?
An element can be used to mean zero or more of the previous:
items ::= {"," item}*
For now, I am using a List from the Domain module. But inline List declarations are not allowed, like this…

NotBad4U
- 1,502
- 1
- 16
- 23
1
vote
0 answers
K framework install failure on MacOS catalina 10.15.6
Hi I am on MacOS catalina 10.15.6 and am trying to install the K-framework using
brew reinstall kframework
I keep getting the error:
Fatal error: …

david streader
- 589
- 2
- 7
1
vote
1 answer
When are K configuration cells type-checked?
It is a common K idiom to define a programming language's syntax with a top-sort of well-formed programs (e.g. Pgm) and then to restrict the cell to have this sort in the configuration declaration using the special $PGM variable which is passed…

Stephen Skeirik
- 43
- 5
1
vote
1 answer
Stateful rules that manipulate global state in K?
Does K have a notion of global state that rules can access?
e.g.
Say a configuration C => C'. I want to transition iff C' doesn't exist in a set of explored states, and then update the global set of explored states by adding C'to it.
I'm trying to…

laifs
- 197
- 1
- 2
- 11
1
vote
1 answer
Structural Operational Semantics in K?
Is there syntax for rules such as:
P => P'
-----------
P + Q => P'
Or would I need to redefine the semantics with evaluation contexts?
There is a book on Big-Step SOS from 2010 on the Kframework website using old syntax:
crl < A1 / A2,Sigma > => <…

laifs
- 197
- 1
- 2
- 11
1
vote
1 answer
How can I "require" two things in one rule of kframework?
I want to "require" two things in one rule. I wrote something like
rule left => right
requires notBool(X in keys(A))
requires notBool(L in keys(B))
But it does not work. Is there a way in K to set multiple constraints on one rule?

Kexiang Wang
- 11
- 1
1
vote
1 answer
How do we use the --pdf flag for generating documentation?
The video tutorial in http://www.kframework.org/index.php/Lesson_4,_LAMBDA:_Generating_Documentation;_Latex_Attributes suggests that we should use kompile lambda --pdf, but when I run it I got the following error:
[Error] Critical: Unknown option:…

Wenhao Su
- 15
- 3
1
vote
1 answer
How to write semantics in K framework for a language similar to ada-spark
I am working with K framework and trying to write semantics for a language similar to ada-spark and in that, I want to write semantics that involves allocation of memory and value when I declare an integer variable itself. Also
for the same…

Ayushi Rastogi
- 11
- 1
0
votes
0 answers
resolving parsing ambiguity for syntactic lists
I am working on parsing promela code using kframework and encountered with ambiguity in the following grammar: (i.e. both Sequence and DeclLst is a syntactic list with separator ;)
Sequence ::= Step ; Sequence
| Step
Step ::= ...
…

Byoungho Son
- 3
- 2
0
votes
1 answer
Computation of dependencies (related to the K prelude)
I'm particularly interested to understand the K prelude (how it is structured, why its content is like that, how "kompile" calculates dependencies, etc).
The main question is: what is the criterion for a hooked symbol from the K prelude to be copied…
0
votes
0 answers
K framework installation repeatedly fails on MacBookPro 19 OS X Mojave 10.14.6
I am trying to install Kframework without success. I installed all the dependencies following instructions at https://github.com/kframework/k/tree/master#prerequisite-install-guide and updated the environment variables as suggested.
I have export…

liuba
- 1