miguel01997 / cookcc

Automatically exported from code.google.com/p/cookcc
Other
0 stars 1 forks source link

Parser controlled lexical states #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I want to parser LilyPond (http://www.lilypond.org) input. That grammar
extensively uses parser-controller lexical state switches. 
I couldn't find a way for this in cookcc

Original issue reported on code.google.com by fodber on 3 Jul 2009 at 10:21

GoogleCodeExporter commented 9 years ago
Changed this issue to a feature enhancement request.

Original comment by superdup...@gmail.com on 21 Jul 2009 at 7:22

GoogleCodeExporter commented 9 years ago
It seems has nothing to do with lexer/parser.  It's about music notation.  So 
it is
up to you to write a parser to adapt it.

Original comment by superdup...@gmail.com on 21 Jul 2009 at 7:38

GoogleCodeExporter commented 9 years ago
What? Have you ever heard of island grammars? 
How would you you implement a C# parser, including LINQ for example without 
something
like that?
If there is no way for the lexer to correctly find out the beginning of a 
grammar
island, it's up to the parser, to change the lexer state.

Original comment by fodber on 28 Sep 2009 at 8:14

GoogleCodeExporter commented 9 years ago
Sorry I misunderstood the question (I thought you were merely talking about 
LilyPond
input).

I think that is trivial.  Both the parser and the lexer are in the same class.  
You
can call the lexer functions, push/pop/switch lexer states without any problems.

Original comment by superdup...@gmail.com on 15 Nov 2009 at 1:56