nitc :: actors_injection_phase
Injects model for the classes annotated with "is actor" sonitc :: astbuilder
Instantiation and transformation of semantic nodes in the AST of expressions and statementsnitc :: i18n_phase
Basic support of internationalization through the generation of id-to-string tablesSerializable::inspect
to show more useful information
nitc :: modelbuilder
more_collections :: more_collections
Highly specific, but useful, collections-related classes.threaded
annotation
serialization :: serialization_core
Abstract services to serialize Nit objects to different formatsnitc :: serialization_model_phase
Phase generating methods (model-only) to serialize Nit objectsnitc :: toolcontext
Common command-line tool infrastructure than handle options and error messagescore :: union_find
union–find algorithm using an efficient disjoint-set data structure
# Compile Nit into Java code runnable on the Java Virtual Machine.
module nitj
import compiler::java_compiler
# Create a tool context to handle options and paths
var toolcontext = new ToolContext
toolcontext.process_options(args)
# We need a model to collect stufs
var model = new Model
# And a model builder to parse files
var modelbuilder = new ModelBuilder(model, toolcontext)
# Collect arguments
var arguments = toolcontext.option_context.rest
if arguments.is_empty then
toolcontext.option_context.usage
return
end
if arguments.length > 1 then
print "Too much arguments: {arguments.join(" ")}"
toolcontext.option_context.usage
return
end
var progname = arguments.first
# Here we load an process all modules passed on the command line
var mmodules = modelbuilder.parse([progname])
if mmodules.is_empty then return
modelbuilder.run_phases
var mainmodule
if mmodules.length == 1 then
mainmodule = mmodules.first
else
mainmodule = new MModule(model, null, mmodules.first.name, mmodules.first.location)
mainmodule.set_imported_mmodules(mmodules)
end
var analysis = modelbuilder.do_rapid_type_analysis(mainmodule)
# Do compilation
modelbuilder.run_java_compiler(mainmodule, analysis)
src/nitj.nit:15,1--59,52