k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- From: Andrei Stefanescu <andreistef AT gmail.com>
- To: Daniele Filaretti <dfilaretti AT gmail.com>
- Cc: k-user AT cs.uiuc.edu
- Subject: Re: [K-user] changing builtin Id definition
- Date: Tue, 9 Apr 2013 12:22:34 -0500
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
Hi Daniele,
You need to add the onlyLabel tag to the token production:
syntax MyId ::= Token{[a-zA-Z\_][a-zA-Z0-9\_]*} [onlyLabel]
Essentially, this says that you only want to use this token syntax to parse programs, and not rules in your semantics. You can take a look at the CIL definition I am currently developing for an example (the syntax file https://code.google.com/p/c-semantics/source/browse/trunk/cil-semantics/cil-syntax.k).
Hope this helps,
Andrei
On Tue, Apr 9, 2013 at 10:40 AM, Daniele Filaretti <dfilaretti AT gmail.com> wrote:
Hi all,
I've been trying to change the definition of builtin Id, because I need Ids which also contains '_'.
I had a look at the work-in-progress manual contained in the K distribution, and ended up with the simple definition, which I used in the definition in place of the old 'Id':
> syntax MyId ::= Token{[a-zA-Z\_][a-zA-Z0-9\_]*}
but this causes a lot of errors in my development. So I tried the same using the IMP definition from the K tutorial, but I have the same problems. The errors apparently also related to K's builtin stuff. I copied here a selection of the errors (the list is quite long, let me know if you want me to post everything).
Related to builtins:
> File: /Users/danielefilaretti/bin/k/include/modules/uris.k
> Location: (87,21,87,74)
> Compilation Phase: Ambiguity filter
> [Warning] Parser: Parsing ambiguity between: "#fReadChar" "(" Int ")" (K1424Syn), # fReadChar (#stdin ) Arbitrarily choosing the first. in the following AST:
> amb(
> #fReadChar ( #stdin ),
> # fReadChar(#stdin)
> )
> File: /Users/danielefilaretti/bin/k/include/modules/uris.k
> Location: (91,23,91,41)
> Compilation Phase: Ambiguity filter
> [Warning] Parser: Parsing ambiguity between: # fReadChar (N:Int ), "#fReadChar" "(" Int ")" (K1424Syn) Arbitrarily choosing the first. in the following AST:
> amb(
> # fReadChar(N:Int),
> #fReadChar ( N )
> )
Related to imp.k:
> File: /Users/danielefilaretti/bin/k/tutorial/2_imp/lesson_4/imp.k
> Location: (56,36,56,38)
> Compilation Phase: Ambiguity filter
> [Warning] Parser: Parsing ambiguity between: X , X:MyId Arbitrarily choosing the first. in the following AST:
> amb(
> X,
> X:MyId
> )
> File: /Users/danielefilaretti/bin/k/tutorial/2_imp/lesson_4/imp.k
> Location: (56,69,56,70)
> Compilation Phase: Ambiguity filter
> [Warning] Parser: Parsing ambiguity between: X:MyId , X Arbitrarily choosing the first. in the following AST:
> amb(
> X:MyId,
> X
> )
Is it a bug or am I missing something obvious?
Cheers,
Daniele
_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user
- [K-user] changing builtin Id definition, Daniele Filaretti, 04/09/2013
- Re: [K-user] changing builtin Id definition, Andrei Stefanescu, 04/09/2013
Archive powered by MHonArc 2.6.16.