Re: Java 8 Parser

2016-10-15 Thread Paul Bennett
On Oct 15, 2016 13:01, "Jeffrey Kegler" 
wrote:
>
> Re #4, why not implement Perl regexes?  A full syntax of Perl regexes is
gruesomely complex, and much of it is symptoms rather than features.

Somewhere deep within perldoc there's a howto on making your own \p{} named
properties, which AFAICT are acceptable to Marpa's regex engine. IIRC, I
once had some progress that way.

--
P/PW/PWBENNETT

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Java 8 Parser

2016-10-15 Thread Jeffrey Kegler
And here's another tutorial with a short example of external lexing:
http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2013/06/mixing-procedural.html

On Sat, Oct 15, 2016 at 4:12 AM, Harry  wrote:

> Thanks, Jeffrey, for your responses.
>
> I've gone through the documentation of Marpa::R2::Scanless::R
>  but
> it's not becoming fully clear how to 'connect' the external lexing routine
> of mine to Marpa's built-in G1 parser. I've looked at some random Marpa
> code on the Net but that code is looking way too complicated as far as
> illustrating just the "external lexing" part goes.
>
> My expectation was (and, is) that of a bison/flex type of interface where
> yyparse() calls yylex() to get the next token following which things
> automatically work. With Marpa, it seems, you have to do (much?) more than
> that (sorry, if I'm being inaccurate here).
>
> What I already understand: When doing external lexing, I assume I'll have
> to create the equivalent of yylex() myself - in my case this function will,
> e.g., be making heavy use of Perl Regex's.
>
> However, how would I pass the string value returned by my yylex() to Marpa
> parser?
>
> Could someone please share a simple, "hello world" type of example, or if
> not that, at least some pseudocode?
>
>
> On Thursday, October 13, 2016 at 10:03:41 PM UTC+5:30, Jeffrey Kegler
> wrote:
>>
>> 4.) Not sure this answers your question, but L0 rules allow full Marpa
>> syntax.
>>
>
> May I ask, why the full Perl Regex syntax is not supported in L0 rules? If
> it were supported, I could've read a Java multi-line comment simply with
> just this one-liner:
> MultilineComment ~ ('/*' .*? '*/')   # parentheses being optional
>
>
> Regards,
> /Harry
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to marpa-parser+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Java 8 Parser

2016-10-15 Thread Jeffrey Kegler
Re #4, why not implement Perl regexes?  A full syntax of Perl regexes is
gruesomely complex, and much of it is symptoms rather than features.

But some of the features *are* useful, including eager matching, which is
what your example depends on.  The obstacle is that Perl regexes are
deterministic, while Marpa is non-deterministic.  TDeterminism imposes
severe limits on regexes -- they're committed to the limits and
inefficiencies of a deterministic approach.  *But* there is a partially
compensating advantage -- deterministic thinking can be easier,
particularly if you get used to its limits.  So, if you are proceeding
deterministically, an instruction to "accept the shortest match" is easy to
implement.

I hope to add eager matching to Marpa::R3.  For now, in Marpa::R2, you have
to re-express the idea in BNF, even in cases where the deterministic
approach is easier and more natural.  Sorry.

Hopefully, the tutorial in my previous answer also shows you how to switch
to lexing in Perl, so you can have the best of both worlds.

Hope this helps! -- jeffrey

On Sat, Oct 15, 2016 at 4:12 AM, Harry  wrote:

> Thanks, Jeffrey, for your responses.
>
> I've gone through the documentation of Marpa::R2::Scanless::R
>  but
> it's not becoming fully clear how to 'connect' the external lexing routine
> of mine to Marpa's built-in G1 parser. I've looked at some random Marpa
> code on the Net but that code is looking way too complicated as far as
> illustrating just the "external lexing" part goes.
>
> My expectation was (and, is) that of a bison/flex type of interface where
> yyparse() calls yylex() to get the next token following which things
> automatically work. With Marpa, it seems, you have to do (much?) more than
> that (sorry, if I'm being inaccurate here).
>
> What I already understand: When doing external lexing, I assume I'll have
> to create the equivalent of yylex() myself - in my case this function will,
> e.g., be making heavy use of Perl Regex's.
>
> However, how would I pass the string value returned by my yylex() to Marpa
> parser?
>
> Could someone please share a simple, "hello world" type of example, or if
> not that, at least some pseudocode?
>
>
> On Thursday, October 13, 2016 at 10:03:41 PM UTC+5:30, Jeffrey Kegler
> wrote:
>>
>> 4.) Not sure this answers your question, but L0 rules allow full Marpa
>> syntax.
>>
>
> May I ask, why the full Perl Regex syntax is not supported in L0 rules? If
> it were supported, I could've read a Java multi-line comment simply with
> just this one-liner:
> MultilineComment ~ ('/*' .*? '*/')   # parentheses being optional
>
>
> Regards,
> /Harry
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to marpa-parser+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Java 8 Parser

2016-10-15 Thread Harry
Thanks, Jeffrey, for your responses.

I've gone through the documentation of Marpa::R2::Scanless::R 
 but 
it's not becoming fully clear how to 'connect' the external lexing routine 
of mine to Marpa's built-in G1 parser. I've looked at some random Marpa 
code on the Net but that code is looking way too complicated as far as 
illustrating just the "external lexing" part goes.

My expectation was (and, is) that of a bison/flex type of interface where 
yyparse() calls yylex() to get the next token following which things 
automatically work. With Marpa, it seems, you have to do (much?) more than 
that (sorry, if I'm being inaccurate here). 

What I already understand: When doing external lexing, I assume I'll have 
to create the equivalent of yylex() myself - in my case this function will, 
e.g., be making heavy use of Perl Regex's. 

However, how would I pass the string value returned by my yylex() to Marpa 
parser?

Could someone please share a simple, "hello world" type of example, or if 
not that, at least some pseudocode?


On Thursday, October 13, 2016 at 10:03:41 PM UTC+5:30, Jeffrey Kegler wrote:
>
> 4.) Not sure this answers your question, but L0 rules allow full Marpa 
> syntax.
>
 
May I ask, why the full Perl Regex syntax is not supported in L0 rules? If 
it were supported, I could've read a Java multi-line comment simply with 
just this one-liner:
MultilineComment ~ ('/*' .*? '*/')   # parentheses being optional


Regards,
/Harry


-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to marpa-parser+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.