k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- From: Radu Mereuta <headness13 AT gmail.com>
- To: "Park, Daejun" <dpark69 AT illinois.edu>
- Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
- Subject: Re: [K-user] [syntax] Best practice for representing a list of somethings
- Date: Sat, 19 Oct 2013 13:28:51 +0300
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
There is also
syntax EPlus ::= NeList{E, ""} // standing for not empty list
Regarding the others, I'm not sure that we have a convention, I think with SDF all of them work correctly. Just don't forget to add the [left] or [right] attribute:
syntax EPlus ::= E | EPlus EPlus [left]
The difference between List{...} and '__ is that the first one creates a cons list with an empty element that signifies the end of the list. The second one, creates a cons list, but you are responsible of handling it in all cases (empty list, one element, more than one element).
Radu
On Fri, Oct 18, 2013 at 10:29 PM, Park, Daejun <dpark69 AT illinois.edu> wrote:
Hi,
This is my first question as a K user!
When it comes to represent the following syntax, what would be the best practice?- e? : zero or one- e* : more than or equal to zero- e+ : more than zero
What I've been trying is:
syntax EOpt ::= E | "" [onlyLabel, klabel("'epsilon")]syntax EStar ::= List{E, ""}
syntax EPlus ::= ??
Am I right? Or, is there more elegant way?
Also, if I should use either of the follows, which one will be better?
syntax EPlus ::= E | E EPlussyntax EPlus ::= E | EPlus EPlus
Thanks in advance!
Daejun
_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user
- [K-user] [syntax] Best practice for representing a list of somethings, Park, Daejun, 10/18/2013
- Re: [K-user] [syntax] Best practice for representing a list of somethings, Radu Mereuta, 10/19/2013
Archive powered by MHonArc 2.6.16.