www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Compile Time D Expression Parser?

reply d coder <dlang.coder gmail.com> writes:
--f46d042c649796c50a04b9d4b6f2
Content-Type: text/plain; charset=ISO-8859-1

Greetings

I need to parse simple D expressions at compile time. I was wondering if
somebody on the list has some example code that could be of help to me.

I am working on an opensource constraint solver  and expressions that I
need to parse can be reasonably complex such as "x + y*n < 32 && x > 4". I
want to code a string mixin that parses such expressions and writes out
code that creates a parse tree for the given expression.

Thanks and Regards
- Puneet

--f46d042c649796c50a04b9d4b6f2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Greetings<div><br></div><div>I need to parse simple D expressions at compil=
e time. I was wondering if somebody on the list has some example code that =
could be of help to me.</div><div><br></div><div>I am working on an opensou=
rce constraint solver =A0and expressions that I need to parse can be reason=
ably complex such as &quot;x + y*n &lt; 32 &amp;&amp; x &gt; 4&quot;. I wan=
t to code a string mixin that parses such expressions and writes out code t=
hat creates a parse tree for the given expression.</div>

<div><br></div><div>Thanks and Regards</div><div>- Puneet</div><div><br></d=
iv>

--f46d042c649796c50a04b9d4b6f2--
Feb 25 2012
next sibling parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 26.02.2012 03:25, schrieb d coder:
 Greetings

 I need to parse simple D expressions at compile time. I was wondering if
 somebody on the list has some example code that could be of help to me.

 I am working on an opensource constraint solver  and expressions that I
 need to parse can be reasonably complex such as "x + y*n < 32 && x > 4".
 I want to code a string mixin that parses such expressions and writes
 out code that creates a parse tree for the given expression.

 Thanks and Regards
 - Puneet

How different is what you want to do from CTFE? http://dlang.org/function.html
Feb 25 2012
next sibling parent Hisayuki Mima <youxkei gmail.com> writes:
(2012/02/26 20:56), d coder wrote:
     Hisayuki Mima's ctpg is compile-time parser generater, and the
     generated parser works in compile time!
     https://github.com/youkei/ctpg

     Kenji Hara


 Thanks Kenji

 This is very interesting. Also I think ctpg is being actively developed.
 I will try to figure out how to make use of it.

 Regards
 - Puneet

Hello, Puneet I'm writing ctpg and really sorry about too little documentation of it. I'm going to at least some sample codes which sketchily shows how to use ctpg within a few days. By the way, ctpg is only parser (and converter) generator. If you want to parse some expressions, you have to write DSL ,which is like PEG or BNF, in order to generate parsers. If that helps, generated parser works in both compile time and run time. Hisayuki Mima
Feb 26 2012
prev sibling next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/26/12 5:07 AM, kenji hara wrote:
 Hisayuki Mima's ctpg is compile-time parser generater, and the
 generated parser works in compile time!
 https://github.com/youkei/ctpg

 Kenji Hara

This seems to be great work, but a 30-seconds skim did not reveal to me how exactly it works. Are there some examples or more documentation? Thanks, Andrei
Feb 26 2012
prev sibling parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 26.02.2012 15:07, kenji hara wrote:
 Hisayuki Mima's ctpg is compile-time parser generater, and the
 generated parser works in compile time!
 https://github.com/youkei/ctpg

 Kenji Hara

Nice! I'm curious as to which parsing method the generated parser does employ (it isn't immediately obvious ;) ). Examples look good, but I don't seem to get how recursive sample fails match(?) e.g. "aaaaa" given the grammar: recursive -> A $ A -> a A a | a I mean it's any odd-length sequence of a. -- Dmitry Olshansky
Feb 27 2012
parent reply Hisayuki Mima <youxkei gmail.com> writes:
(2012/02/27 19:42), Dmitry Olshansky wrote:
 On 26.02.2012 15:07, kenji hara wrote:
 Hisayuki Mima's ctpg is compile-time parser generater, and the
 generated parser works in compile time!
 https://github.com/youkei/ctpg

 Kenji Hara

Nice! I'm curious as to which parsing method the generated parser does employ (it isn't immediately obvious ;) ). Examples look good, but I don't seem to get how recursive sample fails match(?) e.g. "aaaaa" given the grammar: recursive -> A $ A -> a A a | a I mean it's any odd-length sequence of a.

Parsing method which the generated parser employs is Recursive Descent Parsing. And the behavior of the parsers recursive and A is a little bit complicated. The parser recursive matches the sequence of 'a' whose length is 2^n-1 such as 1, 3, 7 and 15. Anyway, I'm going to write more documentation of ctpg within a few days. I hope it'll help you. Hisayuki Mima
Feb 27 2012
next sibling parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 27.02.2012 20:36, Hisayuki Mima wrote:
 (2012/02/27 19:42), Dmitry Olshansky wrote:
 On 26.02.2012 15:07, kenji hara wrote:
 Hisayuki Mima's ctpg is compile-time parser generater, and the
 generated parser works in compile time!
 https://github.com/youkei/ctpg

 Kenji Hara

Nice! I'm curious as to which parsing method the generated parser does employ (it isn't immediately obvious ;) ). Examples look good, but I don't seem to get how recursive sample fails match(?) e.g. "aaaaa" given the grammar: recursive -> A $ A -> a A a | a I mean it's any odd-length sequence of a.

Parsing method which the generated parser employs is Recursive Descent Parsing.

OK, does it check for Left recursive grammars?
 And the behavior of the parsers recursive and A is a little bit
 complicated.
 The parser recursive matches the sequence of 'a' whose length is 2^n-1
 such as 1, 3, 7 and 15.

Well I'm missing something about that BNF-grammar(right?) but undoubtedly: recursive -> A $ -> a A a $ -> a a A a a $ - > a a a a a $ As for task of parsing only 2^n-1 sequences of "a" by CFG that's news for me.
 Anyway, I'm going to write more documentation of ctpg within a few days.
 I hope it'll help you.

Please do, the project with such potential should not stay undocumented. -- Dmitry Olshansky
Feb 27 2012
parent reply Hisayuki Mima <youxkei gmail.com> writes:
(2012/02/28 2:22), Dmitry Olshansky wrote:
 OK, does it check for Left recursive grammars?

No, it doesn't. So currently left recursive grammar causes infinite loop. I know the way to deal with the left recursive grammar well which is using memoization, but memoization causes very bad performance.
 Well I'm missing something about that BNF-grammar(right?) but undoubtedly:
 recursive -> A $ -> a A a $ -> a a A a a $ - > a a a a a $
 As for task of parsing only 2^n-1 sequences of "a" by CFG that's news
 for me.

If it is BNF, the expansion you said (recursive -> A $ -> a A a $ -> a a A a a $ - > a a a a a $) is right. But the DSL which ctpg uses to generate parser is based on PEG. Unlike BNF's choice operator "|", PEG's choice operator "/" is ordered. For details, see: http://en.wikipedia.org/wiki/Parsing_expression_grammar#Definition . Thanks, Hisayuki Mima
Feb 27 2012
parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 28.02.2012 9:19, Hisayuki Mima wrote:
 (2012/02/28 2:22), Dmitry Olshansky wrote:
 OK, does it check for Left recursive grammars?

No, it doesn't. So currently left recursive grammar causes infinite loop. I know the way to deal with the left recursive grammar well which is using memoization, but memoization causes very bad performance.

I haven't thought that was PEG, as these grammars are harder to rewrite automatically.
 Well I'm missing something about that BNF-grammar(right?) but
 undoubtedly:
 recursive -> A $ -> a A a $ -> a a A a a $ - > a a a a a $
 As for task of parsing only 2^n-1 sequences of "a" by CFG that's news
 for me.

If it is BNF, the expansion you said (recursive -> A $ -> a A a $ -> a a A a a $ - > a a a a a $) is right. But the DSL which ctpg uses to generate parser is based on PEG. Unlike BNF's choice operator "|", PEG's choice operator "/" is ordered. For details, see: http://en.wikipedia.org/wiki/Parsing_expression_grammar#Definition .

Ordered is fine, but it still means that once first alternative fails (in this case when we finally hit the end of input) engine has to backtrack(!) then try second, then 3rd etc. More then that, if all of this fails it has to "backtrack" through all choices made on the way and pick other alternatives. This backtracking is what packrat parser optimizes via memoization. By the way this is what makes doing semantic actions problematic in packrat parsing as they have to be 'reverted' once it backtracks.
 Thanks,
 Hisayuki Mima

-- Dmitry Olshansky
Feb 28 2012
prev sibling parent Hisayuki Mima <youxkei gmail.com> writes:
(2012/02/28 2:24), d coder wrote:
 Is it possible to parse any EBNF of arbitrary complexity using your
 parser generator?

Yes, but some rewrites is required. 1) If your EBNF have (indirect) left recursion, you have to eliminate it because the DSL which ctpg uses to generate parser is based on PEG, parsing expression grammar. For details, see: http://en.wikipedia.org/wiki/Parsing_expression_grammar . 2) As the example of parsing simple arithmetic expression shows, the parser generated by ctpg have type such as int and string. EBNF doesn't have type system so you have to add appropriate type conversion into your EBNF. Thanks, Hisayuki Mima
Feb 27 2012
prev sibling next sibling parent d coder <dlang.coder gmail.com> writes:
--f46d040168b917582704b9d9d46f
Content-Type: text/plain; charset=ISO-8859-1

 How different is what you want to do from CTFE?
 http://dlang.org/function.html

I do not want to evaluate the expression in the string at compile time. I want to parse it at compile time and later at run time, I am required to process the parse tree and evaluate it in a different fashion (using binary decision diagrams). In summary, I need CTFE to parse the expression and create a parse tree from it. I think this requires a string mixin that takes the expression string as input and outputs code that builds the corresponding parse tree. Regards - Puneet --f46d040168b917582704b9d9d46f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margi= n-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-= width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;paddin= g-left:1ex"> How different is what you want to do from CTFE?<br><a href=3D"http://dlang.= org/function.html" target=3D"_blank">http://dlang.org/function.html</a></bl= ockquote><div><br></div><div>I do not want to evaluate the expression in th= e string at compile time. I want to parse it at compile time and later at r= un time, I am required to process the parse tree and evaluate it in a diffe= rent fashion (using binary decision diagrams).</div> <div><br></div><div>In summary, I need CTFE to parse the expression and cre= ate a parse tree from it. I think this requires a string mixin that takes t= he expression string as input and outputs code that builds the correspondin= g parse tree.</div> <div><br></div><div>Regards</div><div>- Puneet</div> </div> --f46d040168b917582704b9d9d46f--
Feb 26 2012
prev sibling next sibling parent kenji hara <k.hara.pg gmail.com> writes:
Hisayuki Mima's ctpg is compile-time parser generater, and the
generated parser works in compile time!
https://github.com/youkei/ctpg

Kenji Hara

2012/2/26 d coder <dlang.coder gmail.com>:
 How different is what you want to do from CTFE?
 http://dlang.org/function.html

I do not want to evaluate the expression in the string at compile time. I want to parse it at compile time and later at run time, I am required to process the parse tree and evaluate it in a different fashion (using binary decision diagrams). In summary, I need CTFE to parse the expression and create a parse tree from it. I think this requires a string mixin that takes the expression string as input and outputs code that builds the corresponding parse tree. Regards - Puneet

Feb 26 2012
prev sibling next sibling parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 02/26/2012 03:25 AM, d coder wrote:
 Greetings

 I need to parse simple D expressions at compile time. I was wondering if
 somebody on the list has some example code that could be of help to me.

 I am working on an opensource constraint solver  and expressions that I
 need to parse can be reasonably complex such as "x + y*n < 32 && x > 4".
 I want to code a string mixin that parses such expressions and writes
 out code that creates a parse tree for the given expression.

 Thanks and Regards
 - Puneet

Operator precedence parsers are simple to implement: http://effbot.org/zone/simple-top-down-parsing.htm
Feb 26 2012
parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 02/26/2012 01:00 PM, d coder wrote:
     Operator precedence parsers are simple to implement:

     http://effbot.org/zone/simple-__top-down-parsing.htm
     <http://effbot.org/zone/simple-top-down-parsing.htm>


 Timon

 I want to do all this parsing at compile time in D (using mixins). I
 have just started working on this. I am not sure if CTFE allows so much
 flexibility. I believe I will have to use functional style as in the
 link provided by Kenji. Let me know if I am missing something.

 Regards
 - Puneet

I know. CTFE is flexible enough and implementing this would be quite simple. However, if ctpg serves your needs well, just use that.
Feb 26 2012
parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 02/26/2012 01:55 PM, d coder wrote:
     I know. CTFE is flexible enough and implementing this would be quite
     simple. However, if ctpg serves your needs well, just use that.


 Thanks Timon

    You mean I do not need to use function style when using CTFE?
    I will try parsing myself as you suggested. This approach would give
 me a better handle.

 Regards
 - Puneet

Almost the complete language is available in CTFE, therefore classes could be used to implement the parse tree representation. However, a limitation that does exist is that classes that were created in CTFE cannot yet be stored in static variables or enums. How will the interface to your library look like?
Feb 26 2012
parent Timon Gehr <timon.gehr gmx.ch> writes:
On 02/26/2012 02:07 PM, Timon Gehr wrote:
 On 02/26/2012 01:55 PM, d coder wrote:
 I know. CTFE is flexible enough and implementing this would be quite
 simple. However, if ctpg serves your needs well, just use that.


 Thanks Timon

 You mean I do not need to use function style when using CTFE?
 I will try parsing myself as you suggested. This approach would give
 me a better handle.

 Regards
 - Puneet

Almost the complete language is available in CTFE, therefore classes could be used to implement the parse tree representation. However, a limitation that does exist is that classes

objects, obviously
 that were created in CTFE
 cannot yet be stored in static variables or enums. How will the
 interface to your library look like?

Feb 26 2012
prev sibling next sibling parent d coder <dlang.coder gmail.com> writes:
--f46d040168b93a1c7304b9dcb152
Content-Type: text/plain; charset=ISO-8859-1

 Hisayuki Mima's ctpg is compile-time parser generater, and the
 generated parser works in compile time!
 https://github.com/youkei/ctpg

 Kenji Hara

Thanks Kenji This is very interesting. Also I think ctpg is being actively developed. I will try to figure out how to make use of it. Regards - Puneet --f46d040168b93a1c7304b9dcb152 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote"><br><blockquote class=3D"gmail_quote" style=3D"m= argin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hisayuki Mima= &#39;s ctpg is compile-time parser generater, and the<br> generated parser works in compile time!<br> <a href=3D"https://github.com/youkei/ctpg" target=3D"_blank">https://github= .com/youkei/ctpg</a><br> <br> Kenji Hara<br></blockquote><div><br></div><div>Thanks Kenji</div><div><br><= /div><div>This is very interesting. Also I think ctpg is being actively dev= eloped. I will try to figure out how to make use of it.</div><div><br> </div><div>Regards</div><div>- Puneet=A0</div></div> --f46d040168b93a1c7304b9dcb152--
Feb 26 2012
prev sibling next sibling parent d coder <dlang.coder gmail.com> writes:
--f46d040168b9978efc04b9dcbf0b
Content-Type: text/plain; charset=ISO-8859-1

 Operator precedence parsers are simple to implement:

 http://effbot.org/zone/simple-**top-down-parsing.htm<http://effbot.org/zone/simple-top-down-parsing.htm>

Timon I want to do all this parsing at compile time in D (using mixins). I have just started working on this. I am not sure if CTFE allows so much flexibility. I believe I will have to use functional style as in the link provided by Kenji. Let me know if I am missing something. Regards - Puneet --f46d040168b9978efc04b9dcbf0b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margi= n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=3D"im"=
<br></div>

<br> <a href=3D"http://effbot.org/zone/simple-top-down-parsing.htm" target=3D"_b= lank">http://effbot.org/zone/simple-<u></u>top-down-parsing.htm</a><br> </blockquote></div><br><div>Timon</div><div><br></div><div>I want to do all= this parsing at compile time in D (using mixins). I have just started work= ing on this. I am not sure if CTFE allows so much flexibility. I believe I = will have to use functional style as in the link provided by Kenji. Let me = know if I am missing something.</div> <div><br></div><div>Regards</div><div>- Puneet</div> --f46d040168b9978efc04b9dcbf0b--
Feb 26 2012
prev sibling next sibling parent d coder <dlang.coder gmail.com> writes:
--f46d042c6497eacd9d04b9dd82e7
Content-Type: text/plain; charset=ISO-8859-1

 I know. CTFE is flexible enough and implementing this would be quite
 simple. However, if ctpg serves your needs well, just use that.

Thanks Timon You mean I do not need to use function style when using CTFE? I will try parsing myself as you suggested. This approach would give me a better handle. Regards - Puneet --f46d042c6497eacd9d04b9dd82e7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margi= n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br> I know. CTFE is flexible enough and implementing this would be quite simple= . However, if ctpg serves your needs well, just use that.<br> </blockquote></div><br><div>Thanks Timon</div><div><br></div><div><div>=A0 = You mean I do not need to use function style when using CTFE?</div></div><d= iv>=A0 I will try parsing myself as you suggested. This approach would give= me a better handle.</div> <div><br></div><div>Regards</div><div>- Puneet</div><div><br></div> --f46d042c6497eacd9d04b9dd82e7--
Feb 26 2012
prev sibling next sibling parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
--002354470f6404fb8504b9de1035
Content-Type: text/plain; charset=UTF-8

 Almost the complete language is available in CTFE, therefore classes

limitation that does exist is that classes that were created in CTFE cannot yet be stored in static variables or enums. How will the interface to your library look like? I recently wrote a parsing expression grammar module in D, also to create grammars and parsers at compile-time and parse inputs at CT. (PEG: http://en.wikipedia.org/wiki/Parsing_expression_grammar) Usage is like this: mixin Grammar( "JSON <- '{' ( Pair ( ',' Pair )* )? '}'" , "Pair <- String ':' Value" , "Value <- String / Number / JSON / Array / True / False / Null" , `True <- "true"` (..., rest of JSON grammar) ); enum result = JSON.parse( `{ "Hello":42, "World!": { "a":[0,1,2,3] } }`); I deliberatly used classes to construct the parsers, for I wanted an extended class template example in a big tutorial on templates I'm writing. For now, the resulting grammars are space-insensitive, because I grew tired of always inserting Spaces parsers everywhere. The parse tree is done with a tree struct. Since it holds strings (captures), it can be manipulated at CT to recreate new code. Any tree-walking function can collect the captures to build a D code string which can then be mixed in. For exampe, last week, I created a template constraints parser, to then test the resulting tree with template parameters. It tests the entire constraint with passed parameters and, if it fails, it recursively tests the sub-constraints to find ones that return false. So, given "if (isIntegral!T && !(isFloatingPoint!(U) || is(U : W)))", it will test "isIntegral!T" and so on. All in all, it's quite fun and works OK, it just slows down compilation a bit. What was just an example in a tutorial is slowly becoming its own project. I think I'll put it on Github in a week or two. Philippe --002354470f6404fb8504b9de1035 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p><br> &gt; Almost the complete language is available in CTFE, therefore classes c= ould be used to implement the parse tree representation. However, a limitat= ion that does exist is that classes that were created in CTFE cannot yet be= stored in static variables or enums. How will the interface to your librar= y look like?<br> </p> <p>I recently wrote a parsing expression grammar module in D, also to creat= e grammars and parsers at compile-time and parse inputs at CT.</p> <p>(PEG: <a href=3D"http://en.wikipedia.org/wiki/Parsing_expression_grammar= ">http://en.wikipedia.org/wiki/Parsing_expression_grammar</a>)</p> <p>Usage is like this:</p> <p>mixin Grammar(<br> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &quot;JSON &lt;- &#39;{&#39; ( Pair ( &#39;,= &#39; Pair )* )? &#39;}&#39;&quot;<br> =C2=A0=C2=A0=C2=A0 , &quot;Pair &lt;- String &#39;:&#39; Value&quot;<br> =C2=A0=C2=A0=C2=A0 , &quot;Value &lt;- String / Number / JSON / Array / Tru= e / False / Null&quot;<br> =C2=A0=C2=A0=C2=A0 , `True &lt;- &quot;true&quot;`<br> (..., rest of JSON grammar)<br> );</p> <p>enum result =3D JSON.parse(<br> `{ &quot;Hello&quot;:42, <br> =C2=A0=C2=A0=C2=A0 &quot;World!&quot;:<br> =C2=A0=C2=A0=C2=A0 {<br> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &quot;a&quot;:[0,1,2,3]<br> =C2=A0=C2=A0=C2=A0 }<br> }`);</p> <p>I deliberatly used classes to construct the parsers, for I wanted an ext= ended class template example in a big tutorial on templates I&#39;m writing= . For now, the resulting grammars are space-insensitive, because I grew tir= ed of always inserting Spaces parsers everywhere.</p> <p>The parse tree is done with a tree struct. Since it holds strings (captu= res), it can be manipulated at CT to recreate new code. Any tree-walking fu= nction can collect the captures to build a D code string which can then be = mixed in.</p> <p>For exampe, last week, I created a template constraints parser, to then = test the resulting tree with template parameters. It tests the entire const= raint with passed parameters and, if it fails, it recursively tests the sub= -constraints to find ones that return false.<br> So, given &quot;if (isIntegral!T &amp;&amp; !(isFloatingPoint!(U) || is(U := W)))&quot;, it will test &quot;isIntegral!T&quot; and so on.</p> <p>All in all, it&#39;s quite fun and works OK, it just slows down compilat= ion a bit. What was just an example in a tutorial is slowly becoming its ow= n project. I think I&#39;ll put it on Github in a week or two.</p> <p>Philippe<br> </p> --002354470f6404fb8504b9de1035--
Feb 26 2012
prev sibling parent d coder <dlang.coder gmail.com> writes:
--f46d040168b9600f8e04b9f563fa
Content-Type: text/plain; charset=ISO-8859-1

 Parsing method which the generated parser employs is Recursive Descent
 Parsing.
 And the behavior of the parsers recursive and A is a little bit
 complicated.
 The parser recursive matches the sequence of 'a' whose length is 2^n-1
 such as 1, 3, 7 and 15.
 Anyway, I'm going to write more documentation of ctpg within a few days.
 I hope it'll help you.

I surely do have an EBNF notation for the expressions I want to parse. Is it possible to parse any EBNF of arbitrary complexity using your parser generator? Regards - Puneet --f46d040168b9600f8e04b9f563fa Content-Type: text/html; charset=ISO-8859-1 <div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br></div></div> Parsing method which the generated parser employs is Recursive Descent Parsing.<br> And the behavior of the parsers recursive and A is a little bit complicated.<br> The parser recursive matches the sequence of &#39;a&#39; whose length is 2^n-1 such as 1, 3, 7 and 15.<br> Anyway, I&#39;m going to write more documentation of ctpg within a few days.<br> I hope it&#39;ll help you.<span class="HOEnZb"><font color="#888888"><br><br></font></span></blockquote><div><br></div><div>It sure will. Meanwhile, it would help if you can share some example code.</div><div><br></div><div> I surely do have an EBNF notation for the expressions I want to parse. Is it possible to parse any EBNF of arbitrary complexity using your parser generator?</div><div><br></div><div>Regards</div><div>- Puneet<br></div></div> --f46d040168b9600f8e04b9f563fa--
Feb 27 2012