Hi Alberto,
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.
Cheers,
Alexandre
On 27 Jul 2010, at 17:26, Alberto Bacchelli wrote:
I tried to reproduce the issue on my workspace:
<snip>
octalDigit := PPPredicateObjectParser anyOf: '01234567'.
octalDigits := octalDigit plus.
zeroToThree := PPPredicateObjectParser anyOf: '0123'.
octalEscape := $\ asParser , ( (zeroToThree , octalDigit , octalDigit)
/ (octalDigit , octalDigit) / octalDigit ).
(octalEscape end parse: '\000') isPetitFailure
</snip>
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,
Alberto
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:
<snip>
PPJavaGrammar>>octalEscape
^ $\ asParser , ( (zeroToThree , octalDigit , octalDigit) /
(octalDigit , octalDigit) / octalDigit )
</snip>
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.