Javascript to Java

40 views Asked by At

For the moment we are migrating from an old system using javascript for both backend and frontend code that is stored in a database and that code is interpreted by an external hidden api so we don't know the engine that executes it.

Since the new stack is based on java we thought about transpiling those javascript scripts into java classes and then code the remaning engine and needed methodes for it to run.

The problem is that there is no transpiler as far as I know from javascript to Java.

PS: the code to be converted is relatively simple with basic loops, if and function calls there is no inheritance.

the solution I though about is:

  • generate javascript AST with @babel
  • transform that AST into another one compatible with a java parser
  • use the compatible AST to generate java code (I couldnt find any library that does this)
0

There are 0 answers