On Wed, Jan 18, 2017 at 4:24 AM, Jon Harper <jon.harpe...@gmail.com> wrote:
>
> Should we add words to do this more easily ?
> maybe
> : parse* ( string parser -- ast remaining )
> : parse-all ( string parser -- ast ) ! throws when remaining not empty
>
> Maybe EBNF: can define several words ? (but it's bad for grepability...)

I think the parse* and parse-all words are a good approach, and
document the usage with <EBNF>. Having EBNF: define multiple words can
result in a bit of word explosion but I think it's useful too. You can
get the functionality from an EBNF: word with code like:

EBNF: foo rule= ("a" | "b")* ;EBNF
"abbaXbba" "rule" \ foo rule (parse) remaining>>

Having EBNF: generate a foo* and  a foo-remaining would probably be more useful.

-- 
http://bluishcoder.co.nz

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to