Hello,

I'm trying to write a PEG grammar that would match this input:

  a.a(a).a

And would not match this input:

  a.a(a)

I want my input to always end with ".a".

I tried the following grammar in PEG.js [1] and language.js [2]:

  start = expr !.
  expr = a (dot a / left a right)* dot a
  a = 'a'
  dot = '.'
  left = '('
  right = ')'

But it doesn't work. In PEG.js my first input fails with "Expected "("
or "." but end of input found.".

It seems PEG doesn't try to backtrack at this point. Why doesn't it?
What grammar can work for me?

[1]: http://pegjs.majda.cz/online
[2]: http://languagejs.com/

Alexey

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to