Skip to Content.
Sympa Menu

k-user - [K-user] parsing error?

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

[K-user] parsing error?


Chronological Thread 
  • From: Daniele Filaretti <dfilaretti AT gmail.com>
  • To: k-user AT cs.uiuc.edu
  • Subject: [K-user] parsing error?
  • Date: Wed, 6 Feb 2013 18:06:30 +0000
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

Hi all,
here is another question for you K hackers!

Let say my grammar contains something that looks like

> syntax Exp ::=
>
> | Id "(" Exps ")" // function call
> | Exp "[" Exp "]" [seqstrict] // reading a field from an array (the
> first Exp must evaluate to an array value, the second to a key value)
>

and suppose I write a function, "foo()" that returns an array. Now, if in my
program I write something like

> foo()[0];

I get a parsing error:

> [Error] Critical: Parse error: Syntax error near unexpected character ';'
> File: test.php
> Location: (5,9,5,9)


As an experiment, I tried to add

> syntax Exp ::= "(" Exp ")" [bracket]

and then, if I evaluate

> (foo())[0]:


it works!

Am I missing something or is a parsing problem?

Thanks a lot!

Cheers,
Daniele






Archive powered by MHonArc 2.6.16.

Top of Page