1

I'm trying to scan and parse my toy language with Flex and Bison which is in C++. I wonder if there is any resources explaining how to generate JVM bytecode from AST in C++. Many thanks!

Tian Jin
  • 279
  • 1
  • 3
  • 9

2 Answers2

1

The language you're using to generate code is halfway moot unless you can find a library to help you. Since most of the tools for directly manipulating Java bytecode seem to be written in Java, your best bet might be output Jasmin assembly, then assembly it into bytecode.

David Ehrmann
  • 7,366
  • 2
  • 31
  • 40
1

An even easier method is to print Java code and run that through javac.

Ingo
  • 36,037
  • 5
  • 53
  • 100