k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- From: samira kherfellah <samira.kherfellah AT gmail.com>
- To: k-user AT cs.uiuc.edu
- Subject: [K-user] Variables declaration
- Date: Wed, 10 Apr 2013 10:41:12 +0200
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
Hi all,
I want to declare variables in my program, for this, I added in my syntax:
syntax Vardecl ::= "var" Id TypeVar ";"
syntax TypeVar ::= "integer" | "boolean" | "string"
I added in the semantic, these rules:
rule <k> var X integer ; => X:Int ...</k>
rule <k> var X boolean ; => X:Bool ...</k>
rule <k> var X string ; => X:String ...</k>
In the program test, i have:
...
process p(1);
const M = 5 ;
var i integer;
state init2 #start ;
...
provided (i < M);
...
endstate ;
endprocess;
...
But at compilation, 'i' is not recognized as integer. I forgot something in the syntax or semantics?
Sincerly,
I want to declare variables in my program, for this, I added in my syntax:
syntax Vardecl ::= "var" Id TypeVar ";"
syntax TypeVar ::= "integer" | "boolean" | "string"
I added in the semantic, these rules:
rule <k> var X integer ; => X:Int ...</k>
rule <k> var X boolean ; => X:Bool ...</k>
rule <k> var X string ; => X:String ...</k>
In the program test, i have:
...
process p(1);
const M = 5 ;
var i integer;
state init2 #start ;
...
provided (i < M);
...
endstate ;
endprocess;
...
But at compilation, 'i' is not recognized as integer. I forgot something in the syntax or semantics?
Sincerly,
Samira
- [K-user] Variables declaration, samira kherfellah, 04/10/2013
- Re: [K-user] Variables declaration, Mark Hills, 04/10/2013
- Re: [K-user] Variables declaration, Mark Hills, 04/10/2013
- Re: [K-user] Variables declaration, Mark Hills, 04/10/2013
Archive powered by MHonArc 2.6.16.