k-user AT lists.siebelschool.illinois.edu
Subject: K-user mailing list
List archive
Re: [K-user] Once working K program is now broken, need help (do we have changelogs ?)
Chronological Thread
- From: Radu Mereuta <headness13 AT gmail.com>
- To: Ömer Sinan Ağacan <omeragacan AT gmail.com>
- Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
- Subject: Re: [K-user] Once working K program is now broken, need help (do we have changelogs ?)
- Date: Mon, 9 Sep 2013 16:21:52 +0300
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
Hi Ömer,
Try using List{Test,""}, without the space inside the separation terminal.
The problem lays with SDF, the parser that we are using in K. Space is part of the layout definition (whitespaces that separate tokens in the grammar) and sometimes it has problems handling spaces, eol... inside terminals.
If you use the list without the space, you will get a similar grammar for your language. Since Ids will match in a greedy way, the input `[a b]` will parse the same with both grammars. In your original grammar the space between the 'a' and 'b' should go to the list separator, and in the second grammar, the space would parse as layout, and will automatically be discarded when creating the AST.
I will discuss this with the rest of the group and negotiate a warning message that disallows whitespace inside terminals.
Radu
K developer
On Fri, Sep 6, 2013 at 11:31 PM, Ömer Sinan Ağacan <omeragacan AT gmail.com> wrote:
Dear K users,
This simple K program demonstrates a feature that works in an older
version K framework but fails with latest version:
module TEST-SYNTAX
syntax Lst ::= List{Test, " "}
syntax Test ::= Id
| "[" Lst "]"
endmodule
module TEST
imports TEST-SYNTAX
endmodule
This compiles fine with both old and latest versions .. The problem is
it doesn't parse this simple program `[a b]` in latest version(fails
with "Critical: Parse error: Syntax error near unexpected character
'b'")
Anyone has ideas on this?
Thanks.
---
Ömer Sinan Ağacan
http://osa1.net
_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user
- [K-user] Once working K program is now broken, need help (do we have changelogs ?), Ömer Sinan Ağacan, 09/06/2013
- Re: [K-user] Once working K program is now broken, need help (do we have changelogs ?), Radu Mereuta, 09/09/2013
- Re: [K-user] Once working K program is now broken, need help (do we have changelogs ?), Ömer Sinan Ağacan, 09/09/2013
- Re: [K-user] Once working K program is now broken, need help (do we have changelogs ?), Robby Findler, 09/09/2013
- Re: [K-user] Once working K program is now broken, need help (do we have changelogs ?), Rosu, Grigore, 09/09/2013
- Re: [K-user] Once working K program is now broken, need help (do we have changelogs ?), Ömer Sinan Ağacan, 09/09/2013
- Re: [K-user] Once working K program is now broken, need help (do we have changelogs ?), Radu Mereuta, 09/09/2013
Archive powered by MHonArc 2.6.16.