Skip to main content

Timeline for How can I define this syntax?

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Aug 18, 2013 at 19:43 comment added Raphael @israkir First, my example are minimal by design; the problem is the same if you add more alternatives to the inner parenthese. As for your grammar, syntax is not your problem, its the semantics. (Because of the rule $S \to T$, the distinction between $S$ and $T$ is useless.)
Aug 18, 2013 at 16:49 comment added israkir I think, (a | (b)) or (a | (x) | b) is not something I want my grammar to parse. The whole idea behind parenthesis is that it generates an alternative in the path such as (a, (b, c)) generates two path coming from b: a --> b or a --> c (or nothing else). So, I came up with this grammar: \begin{align} S &\to (S) \mid T\mathtt{,} S \mid (T\mathtt{\mid} S) \mid T\\ T &\to [\mathtt{a}\dots\mathtt{z}] \end{align} What do you think?
Aug 18, 2013 at 16:25 comment added Raphael @israkir Because (a | b ) means "either a, or b, or nothing" but (a | (b)) does mean something entirely else. Particularly troublesome is that in situations like (a | (x) | b) you may choose only one of a and b, but if x is there a has to be before and b after.
Aug 18, 2013 at 15:38 comment added israkir I think, the context of inner parenthesis is that "the nodes in parenthesis always define an alternative path adding possible node to the path and concatenating rest according to the parenthesis". So, I couldn't see why bar notation causes problem for the second warning?!
Aug 18, 2013 at 10:51 comment added Raphael @israkir Switching to bars does away with the first warning, not the with the second.
Aug 17, 2013 at 13:31 comment added israkir BTW, I edited the question accordingly.
Aug 17, 2013 at 13:28 comment added israkir For the warnings, I agree! Yes, I think this was the part made confused a lot. So, I'd better to change comma notation inside the parenthesis with bar "|" notation (which probably fits better for the meaning also).
Aug 17, 2013 at 13:12 history answered Raphael CC BY-SA 3.0