One technique that is documented and tested and I believe should work is 
the Ruby Slippers.  See the docs on this, but the basic idea would be, in 
the default lexer look only for commands.  If the parse stops for lack of a 
lexeme, give it an LHS, and resume the parse.  Otherwise, or if it also 
rejects LHS token, pass the failure on to the user.

On Wednesday, December 2, 2020 at 7:05:37 PM UTC-5 due...@gmail.com wrote:

>
> No problem, thanks for trying. I did plug it in and indeed got the same 
> results.
>
>
> On 12/2/20 6:41 PM, Jeffrey Kegler wrote:
> > Oops!  Ignore that last!  It suffers from the same problem -- longest 
> captures the match and all the rest of that hack-ish apparatus I talked 
> about would be ignored.
> > 
> > I've been doing mainly LaTeX these days and obviously it is turning my 
> brain into mush.
> > 
> > Sorry!
> > 
> > On Wednesday, December 2, 2020 at 5:55:24 PM UTC-5 Jeffrey Kegler wrote:
> > 
> > How many commands?  One approach that I just thought of and have never 
> tested is to have fixed length variables, prioritized versus the commands 
> of that length.
> > 
> > Off the top of my head:
> > 
> > var2 ~ <varchar><varchar> priority=>1
> > PA_command ~ 'PA' priority=>2
> > PR_command ~ 'PR' priority=>2
> > 
> > include a catch-all var for lengths not specifically accounted for
> > 
> > var_catch ~ <varchar>+ priority=>0
> > 
> > <var_catch> will always lose to lexemes of the same length, but will 
> catch those variables whose length is not the same as any command.
> > 
> > A little hack-ish, but should be very fast, and perhaps no more hack-ish 
> than alternatives.
> > 
> > Again, not tested, so you'll be a pioneer!  If you try it, let me know!
> > 
> > Hope this helps, jeffrey
> > 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/marpa-parser/e12b9f0d-8fad-4ad3-92af-c13707a87e29n%40googlegroups.com.

Reply via email to