Skip to Content.
Sympa Menu

k-user - Re: [K-user] String format parsing question

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [K-user] String format parsing question


Chronological Thread 
  • From: SITTHISAK Pakakorn <pakakorn.s AT jaist.ac.jp>
  • To: Radu Mereuta <headness13 AT gmail.com>
  • Cc: k-user AT cs.uiuc.edu
  • Subject: Re: [K-user] String format parsing question
  • Date: Sun, 6 Apr 2014 01:06:24 +0900 (JST)
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

Hi,

I have been doing this but it still couldn't be succeeded.
I did follow your suggestion by testing

syntax MyString ::= Token{"'" ((~[\'\n\r\\])|([\\]~[\n\r]))* "'"}


Here, I have already changed my K framework to the master version.
I also checked inside your fix in the code.
It still showed error as follow.

[Error] Parser: org.kframework.parser.basic.ParseException: Encountered " "|"
"| "" at line 2, column 43.

And also, I have another thing to ask.

I would like to let MyString to use library function in String buildin.
My one idea is changing every MyString to String     
         
            rule ' Content ' => " Content "

Note that, Content is variable represent something inside.
My language has to syntax of String, but I would consider consider changing every string into "..." syntax.
However, I have no idea about writing corrected rule syntax.

Thank you in advance

Regards,
Pakakorn


From: "Radu Mereuta" <headness13 AT gmail.com>
To: "SITTHISAK Pakakorn" <pakakorn.s AT jaist.ac.jp>
Cc: k-user AT cs.uiuc.edu
Sent: Saturday, March 29, 2014 4:31:03 AM
Subject: Re: [K-user] String format parsing question

Hi,

Sorry for the late reply. At the moment we are in the process of overhauling the syntax of K and I had to fix a few things in order to allow you to write that types of strings.
I've pushed a change that will soon be approved and you could define your own strings with something like this:
syntax MyString ::= Token{"'" ((~[\'\n\r\\])|([\\]~[\n\r]))* "'"}

You can check here when the changes will be available in the master branch: https://github.com/kframework/k/pull/317
(I think it's going to be a matter of hours)

Thanks for reporting the issue,
Radu
K developer


On Wed, Mar 26, 2014 at 11:03 PM, SITTHISAK Pakakorn <pakakorn.s AT jaist.ac.jp> wrote:
Hi,

I am new user of K.
I am thinking of parsing String format on my language.

"string" and 'string'

I would like String buildin to accept this 'string' too.
Could anybody suggest me how to deal with or give me related site I could check?

Thank you in advance.

Regards
Pakakorn




_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user







Archive powered by MHonArc 2.6.16.

Top of Page