I'm looking for a Java library that would allow for modeling the elements of the source of an OOP programming language and performing post-parse semantic analysis on them.

This library might have classes like "Class", "DataMember", "Method", "Type", "Instruction", etc.

Many compilers implement their own semantic model, despite closely-related languages having similar semantic models that are easy to abstract into a generic one covering those related cases.

I'm planning to use this to toy around by implementing transcompilers.

  • I think you'll find that trying to abstract away the differences between languages, will give you a program representation with sloppy semantics. And then you can't "transpile" it right. A class in Java seems a lot like one in JavaScript, but "inheritance" works completely differently.
    – Ira Baxter
    Aug 27, 2018 at 0:40

1 Answer 1


I'm using Polyglot.

The API is particularly anti-ergonomic, ugly and against pretty much each one of modern Java conventions I know. But it seems to do the job.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.