On Sun, Jan 18, 2009 at 11:33 AM, Paul Moore <p.f.mo...@gmail.com> wrote:
> I wrote the following parser in factor:
>
> EBNF: omega
> omega = 'O' 'm' 'e' 'g' 'a' | . omega
> ;EBNF

I can't test your code since I've only got access to a Windows machine
and Factor doesn't run under Windows for me. When I'm next on a Linux
machine I'll try it out.

This won't make a difference to your example but you can use the
string "Omega" instead of each character individually:

> EBNF: omega
> omega = "Omega" | . omega
> ;EBNF

You can use peg.search to find things as well:

"...string containing bible text..." <EBNF rule= "Omega" EBNF> search

This actually converts the query to something like:

<EBNF rule=("Omega" | .) repeat0 EBNF>

Does the lua peg VM handle left recursive rules? My Factor peg
solution does that uses the algorithm outlined by vpri which does make
Factor's peg's not-quite-peg and has different performance
characteristics.

> As a side note, there doesn't seem to be much documentation of the peg
> modules (or I'm not finding it somehow). Most of what I've found out,
> I got from reading some of the articles on Chris Double's website. Is
> there anything else I can look at on the subject? I tried reading the
> source, but my head exploded :-)

I haven't documented it as it's not complete. I wrote it as an
experiment with the syntax and functionality likely to change as I
explore different directions. Not documenting it is a warning that
this is the case. Someone then moved it from extra to basis which has
encouraged usage of it.

Chris.
-- 
http://www.bluishcoder.co.nz

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to