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: Radu Mereuta <headness13 AT gmail.com>
  • To: SITTHISAK Pakakorn <pakakorn.s AT jaist.ac.jp>
  • Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
  • Subject: Re: [K-user] String format parsing question
  • Date: Mon, 7 Apr 2014 12:50:13 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

Hi,

I've tested this, and it should work. Be sure that you are using the latest build from master.
The best way to do this, would be to use `git checkout`, and build using `ant`. (you will need Git command line and ant in your system, and JDK).

Regarding the rules... you can't match the content of a token. That's atomic. You will need primitives/builtin operations to strip the first and last character of your strings.
I'm not sure about how to do that. I will ask around.

Radu


On Sat, Apr 5, 2014 at 11:06 AM, SITTHISAK Pakakorn <pakakorn.s AT jaist.ac.jp> wrote:
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