I keep seeing references to "fcode" in the compiler source. Is that a Fan-specific intermediate code? Or is it an existing technology? How does fcode fit into the compilation process?
brianWed 30 Apr 2008
The compiler outputs a pod file which is a zip file containing fcode. For scripts this zip file is just a memory buffer. Fcode is essentially Fan bytecode which is portable between the Java and .NET runtimes. Then at runtime the Java or .NET runtime takes the fcode and emits Java bytecode or .NET IL. There are two main advantages to having the intermediate fcode:
a single pod file is portable between the Java and .NET runtime
we avoid fragile base class issues with mixins, because don't actually implement the "mixin routers" until load time
The compiler process is summarized as:
parse source into AST
manipulate/check/normalize the AST thru the series of steps
tactics Wed 30 Apr 2008
I keep seeing references to "fcode" in the compiler source. Is that a Fan-specific intermediate code? Or is it an existing technology? How does fcode fit into the compilation process?
brian Wed 30 Apr 2008
The compiler outputs a pod file which is a zip file containing fcode. For scripts this zip file is just a memory buffer. Fcode is essentially Fan bytecode which is portable between the Java and .NET runtimes. Then at runtime the Java or .NET runtime takes the fcode and emits Java bytecode or .NET IL. There are two main advantages to having the intermediate fcode:
The compiler process is summarized as:
The pod is a normal zip file which contains:
You can use fanp to disassemble the fcode to see what it looks like.
Hope that provides a good summary! Please let me know if you'd further details.