k-legacy icon indicating copy to clipboard operation
k-legacy copied to clipboard

Usage questions

Open findo opened this issue 8 years ago • 1 comments

How to separate variables with newlines using KList? For example, I want to separate like this "x \n y \n z", not "x,y,z".

findo avatar Jan 18 '17 04:01 findo

Sorry for the delay in replying. You can declare a list whose elements are separated by white spaces, as follows:

syntax YouList ::= List{YourElem, ""}

Note that K doesn't distinguish different white spaces. Indeed, K parser ignores all white spaces. That means the above list will accept all in below:

x \n y \n z
x \t y \t z
x y z
x  \n   y    z
...

daejunpark avatar Feb 05 '17 22:02 daejunpark