Replies: 2 comments 2 replies
-
No, I don't think so. This project is focused on converting Java code to TypeScript. I can imagine an abstraction to generate TypeScript from an internal data representation (and later other target languages), but that's currently out of scope. What the project demonstrates, however, is how to convert one language to another in the most simple manner. It includes the parser, tree walker, symbols management (symbol tables, symbol resolution) and so on. So from this perspective it could serve as a template or example. |
Beta Was this translation helpful? Give feedback.
-
Hi Mike, After looking closer at the code I see you're not creating an AST from the Java visitor - that was my biggest interest. Regardless, there's still value in understanding general approach and principles employed. Are you aware of any ANTLR4-based transpiler projects employing traditional parser->tree->visitor->AST->render workflow? Best |
Beta Was this translation helpful? Give feedback.
-
Hi @mike-lischke
I'm in the process of designing a transpiler for converting Pro*C (c99 with embedded Sql) to Java.
I'm already using ANTLR - same as you, and I managed to customize the C grammar using modes to extract sql as text blocks for parsing later with PlSql grammar. The surrounding C code is parsed as-is, so basically I have parse trees for both C and PlSql code.
Next step is building the intermediate/abstract syntax tree using custom listener and visitor classes for symbol tables and extracting source elements, respectively. This part is more complex and while I have a general idea on how to proceed I'm having difficulty finding code samples using ANTLR4 - the MongoDB write up however, was decent. At any rate, given my objectives, is this project a suitable guide for transpiler implementation strategies?
Best,
-R
Beta Was this translation helpful? Give feedback.
All reactions