Alexandre thank you for your suggestion.
Actually, I already used srcML last year for another project,
as you suggested me.
Unfortunately, this time, I really need such a grammar in PetitParser
Since I am not proficient enough with PetitParser, I discarded the
idea of creating a translator
from grammars specified in other syntaxes (e.g., antlr) to PetitParser.
I hope to be able to do it in the future :)
On 27 July 2010 17:39, Bergel, Alexandre <bergel(a)iam.unibe.ch> wrote:
The Java grammar is quite large. If you want to import Java code into Moose without using
inFuzion, an alternative is to take the output of srcML (which is able to process Java)
and to realize XPath queries.
The tricky part to represent Java code in Moose is about the type resolution. This is not
trivial (not difficult, just extremely boring). Even though a type evaluator is easily
implementable, it is a bit like implementing a semantic evaluator.
On 27 Jul 2010, at 17:26, Alberto Bacchelli wrote:
> I tried to reproduce the issue on my workspace:
> octalDigit := PPPredicateObjectParser anyOf: '01234567'.
> octalDigits := octalDigit plus.
> zeroToThree := PPPredicateObjectParser anyOf: '0123'.
> octalEscape := $\ asParser , ( (zeroToThree , octalDigit , octalDigit)
> / (octalDigit , octalDigit) / octalDigit ).
> (octalEscape end parse: '\000') isPetitFailure
> In this case, it seems that changing the order of the different options
> ( (zeroToThree , octalDigit , octalDigit) / (octalDigit , octalDigit)
> / octalDigit )
> matters. In fact, with the longest option, it is able to recognize all
> the possibility.
> So, is it correct that I have to put always the longest option in this cases?
> Are there other approaches?
> Finally, it does not work in the compiled PPJavaGrammar class.
> Is there a way to reset all the variables, so that they will be
> recompiled again?
> Thank you,
> On 27 July 2010 17:08, Alberto Bacchelli <alberto.bacchelli(a)usi.ch> wrote:
>>> Is there something wrong with my implementation,
>>> or didn't I understand correctly the '/' operator?
>> I also tried to change the implementation of octalEscape in the following way
>> (to put the longest match as the first option), but without good results:
>> ^ $\ asParser , ( (zeroToThree , octalDigit , octalDigit) /
>> (octalDigit , octalDigit) / octalDigit )
> Moose-dev mailing list
Alexandre Bergel http://www.bergel.eu
Moose-dev mailing list