nitc :: actors_generation_phase
Generate a support module for each module that contain a class annotated withis actor
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
nitc :: serialization_code_gen_phase
Phase generating methods (code) to serialize Nit objectsserialization :: serialization_core
Abstract services to serialize Nit objects to different formatsnitc :: serialization_model_phase
Phase generating methods (model-only) to serialize Nit objectsserialize_to_json
and JsonSerializer
nitc :: toolcontext
Common command-line tool infrastructure than handle options and error messagescore :: union_find
union–find algorithm using an efficient disjoint-set data structure
# The Nit virtual machine launcher
module nitvm
import vm
import frontend::code_gen
# Create a tool context to handle options and paths
var toolcontext = new ToolContext
toolcontext.tooldescription = "Usage: nitvm [OPTION]... <file.nit>...\nExecutes Nit programs with a virtual machine."
# Add an option "-o" to enable compatibility with the tests.sh script
var opt = new OptionString("compatibility (does nothing)", "-o")
toolcontext.option_context.add_option(opt)
var opt_mixins = new OptionArray("Additional modules to min-in", "-m")
toolcontext.option_context.add_option(opt_mixins)
# We do not add other options, so process them now!
toolcontext.process_options(args)
# We need a model to collect stufs
var model = new Model
# Add a model builder to parse files
var modelbuilder = new ModelBuilder(model, toolcontext)
var arguments = toolcontext.option_context.rest
var progname = arguments.first
# Here we load and process all modules passed on the command line
var mmodules = modelbuilder.parse([progname])
mmodules.add_all modelbuilder.parse(opt_mixins.value)
modelbuilder.run_phases
if toolcontext.opt_only_metamodel.value then toolcontext.quit
var mainmodule: nullable MModule
# Here we launch the interpreter on the main module
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 self_mm = mainmodule
var self_args = arguments
modelbuilder.run_virtual_machine(self_mm, self_args)
src/nitvm.nit:17,1--63,52