Project Ometa_Compiler Doesn't Replace Used Compiler
xixixao opened this issue · 1 comments
At the end of the file,
// now we'll make sure that our translator actually worked by replacing
// the original OMeta parser and compiler with the ones defined here
BSOMetaParser = OMetaParser
BSOMetaTranslator = OMetaTranslator
suggests that from then on it will use the presented parser+translator, but it seems that BSJSOMetaParser , not BSOMetaParser is used (same for Translator). If I leave the code as it is, and change the translator source code, the changes have no effect.
Update: For future reference, I got this impression by slightly changing the translator (like disabling the "trans" rule), which didn't have effect on the given "Duh" example).
That's not right -- BSOMetaJSParser uses BSOMetaParser via foreign rule invocation, and the same goes for BSOMetaJSTranslator and BSOMetaTranslator. Take a look at http://tinlizzie.org/ometa-js/bs-ometa-js-compiler.txt:
ometa BSOMetaJSParser <: BSJSParser {
srcElem = spaces BSOMetaParser.grammar:r sc -> r
| ^srcElem
}
ometa BSOMetaJSTranslator <: BSJSTranslator {
Grammar = BSOMetaTranslator.Grammar
}