This is a very basic question. I tried searching SO, but couldn't get any solid answer. Sorry if it's really basic.
I'm trying to write a plugin/library to convert Javascript into Apache Jelly.
So the idea is to write Javascript code, which will be converted to Jelly code.
example: Javascript like code:
if(x == 1){
print("inside if");
}
Apache converted code:
<j:if test="x=1">
inside if
</j:if>
The question is, how do I parse the entire Javascript code and replace it with some other code. I did have a look at Jison but that basically is a parse generator, which parses the values AND interpret them. I feel using jison is kinda overhead for my task.
Any idea what I can use to achieve what I'm trying to do?
Edit 1: Yes, there is a Javascript top down parser at JSLint, but any easy way to specify what needs to be replaced? for example, in the above code - replacing if loop with <j:if>