+# The class visiting the AST
+#
+# A visitor is attached to one JavaCodeFile it writes into.
+class JavaCompilerVisitor
+ super Visitor
+
+ # JavaCompiler used with this visitor
+ type COMPILER: JavaCompiler
+
+ # The associated compiler
+ var compiler: JavaCompiler
+
+ # The file to write generated code into
+ var file: JavaCodeFile
+
+ # Code generation
+
+ # Add a line (will be suffixed by `\n`)
+ fun add(line: String) do file.lines.add("{line}\n")
+
+ # Add a new partial line (no `\n` suffix)
+ fun addn(line: String) do file.lines.add(line)
+end
+