Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] Jikespg syntax description used in ...compiler.batch/grammar/java.g

Hi Alexander,

Actually, the grammar language isn't very sophisticated, I'd say. At least the portion that JDT uses. The actual grammar rules are a plain-vanilla variant of BNF. Few more things are used like "/.$putCase ... ./" to generate case statements inside Parser.consumeRule() and "/:$readableName ... :/" to provide names for use in error messages. Ah, and of course "/:$compliance ...:/" specifies since which version a given rule is allowed. "$empty" speaks for itself, doesn't it?

I know that making arbitrary grammars comply to the LALR(1) rules can be very tricky, but that's not a problem of the input language, is it?

I suggest you ask specific questions, so that those who have been editing java.g over the years (despite the absence of documentation) can provide specific help from their experience.

best,
Stephan


Am 02.01.23 um 10:13 schrieb Alexander Kriegisch:
Hi there from the AspectJ team.

We are having a little problem with the Java language grammar we adjusted for native AspectJ syntax extensions. I am unexperienced in building lexers and parsers and only partly understand the syntax of the grammar file. In order to tackle the issue at hand, I would like to learn how to read a Jikespg grammar, but cannot find any resource describing it. Is the syntax borrowed from any other tool in the lexer and parser generator realm? Lex, Yacc, ANTLR, you name it. I adjusted a few things in the AspectJ grammar in the past after merging in upstream changes from JDT Core, but I did not change anything substantial there. I really wish to understand better what I am doing there. Therefore, I would be glad to receive any helpful replies. Even small hints will be welcome.

Thank you in advance and kind regards



Back to the top