You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phantom language compiler is used as compiler itself and as backend (byte code generator) for other frontends, namely - jvm to phantom convertor (jpc).
See /test/plc directory. This test can be used if you need to check if compiler generates same code as before. Just run tests and compiler listing files will be compared with reference ones. Note that it runs compiler defined in build/bin & build/jar. Usually it is not the latest code you made in tools/plc.
phatom/vm/pvm_test can be run to execute compiled bytecode. See also Debugging.
Unit tests in tools/plc/src/test
Class reference - compiler
Parser itself, recursive one. Most methods parse one source code construct, such as expression or operator. returns Node, which is AST tree node. Uses Lex as lexical analyzer, ParserState to keep track ow what is being comiled (class, method, maps of stack variables) and list of referenced classes.
Node class represents node of abstract representation of program.
find_out_my_type() - if possible, decide about this node's expression type by looking at descendants (parameters) or by node nature.
preprocess() - must be called after we finished all parsing and before we're trying to do something else, such as generatimg code or just printing/listing.
generate_code() - lays out bytecode for this subtree.