Parser questions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Parser questions

Bertalan Fodor
Hello,

I'm very close to finish a Java-based parser for lilypond. I will use
this in jEdit-LilyPondTool for instant error checking and advanced code
completion and refactoring.
However, I found that it not trivial to identify certain token types. So
I'd like to ask here to show me examples or explain what these (or some
of these) are, or where they come from.
I know two kind: MUSIC_FUNCTION* and MARKUP*etc.

STRING_IDENTIFIER
SCM_IDENTIFIER (I know \major and \minor is one example, but don't see
where they come from)
SCORE_IDENTIFIER
CONTEXT_DEF_IDENTIFIER
OUTPUT_DEF_IDENTIFIER
DURATION_IDENTIFIER

Asking from the other side:
what token types are what I can can find in property-init.ly?

Finding these would allow me to make a very good parser DB and parser.

Any directions are welcome.

Thank you,

Bert



_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Parser questions

Han-Wen Nienhuys
Bertalan Fodor wrote:
> Hello,
>
> I'm very close to finish a Java-based parser for lilypond. I will use

Wow. Do you also parse Scheme?

> this in jEdit-LilyPondTool for instant error checking and advanced code
> completion and refactoring.
> However, I found that it not trivial to identify certain token types. So
> I'd like to ask here to show me examples or explain what these (or some
> of these) are, or where they come from.
> I know two kind: MUSIC_FUNCTION* and MARKUP*etc.
>
> STRING_IDENTIFIER

foo = "string"

> SCM_IDENTIFIER (I know \major and \minor is one example, but don't see
> where they come from)

any Scheme value not covered by other identifier types. See

   Lily_lexer::try_special_identifiers (SCM *destination, SCM sid)

in parser.yy

> SCORE_IDENTIFIER

foo = \score  { ... }

> CONTEXT_DEF_IDENTIFIER

foo = \context  { .. }

> OUTPUT_DEF_IDENTIFIER

foo = \layout { .. }


> DURATION_IDENTIFIER

foo = #(ly:make-duration ... )


--
  Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Parser questions

Bertalan Fodor

> Wow. Do you also parse Scheme?

Yes, but currently using brute-force (based on the EBNF, using many
infinite look-aheads).

Actually, I'm using antlr, which is a predictive LL(k) parser, so I need
to convert from LR to LL. However, my specification is to "accept all
valid input and disallow most invalid inputs", and this goal is closer
and closer.

Bert


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel