SMAP, a.k.a. JSR 45. How easy would it be to apply to JavaCC?

I came across this a while ago and made a mental note that it was very likely useful for JavaCC development. SMAP stands for “source map format” and it basically amounts to a way of supporting non-Java languages that compile down to bytecode. See here.

I assume that this mostly envisaged things like Jython and JRuby. However, I think it applies pretty well to a code generator like JavaCC. Especially now that there is the code injection feature it is quite appealing to have a situation where a debugger steps through the code where it really originates – i.e. in the grammar file, not in the generated source file.

Of course, the first step is to do an evaluation of how hard it is to get this working with JavaCC. Perhaps not very hard. Oh, also, I noticed that there is an eclipse plugin for ANTLR that has this feature, i.e. it generates SMAP info for ANTLR generated parsers. BUT…

  1. It does not seem that whatever work was done on this here was ever rolled into ANTLR itself.
  2. The eclipse plugin seems like it may be abandonware, since the main page on Sourceforge refers to ANTLR 2.7.6, when ANTLR is on version 4.8 now.

Anyway, for anybody who wants to get involved in JavaCC, this whole SMAP thing could well be a good entry point since it is fairly well defined sub-project or mini-project that one could have some success with in short order. So, I thought to start this topic…