From 93e6535a2f291bcf434aa12e23e81939f1828208 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 3 Sep 2014 10:18:21 -0400 Subject: [PATCH] src: add new hub modules to regroup related things together. modelize: for modelize_* semantize: for typing/auto_super_init/scope/flow/etc. compiler: for compiler related things interpreter: for interpreter related things Signed-off-by: Jean Privat --- src/abstract_compiler.nit | 3 +-- src/android_annotations.nit | 4 ++-- src/astprinter.nit | 2 +- src/cached.nit | 2 +- src/compiler.nit | 24 ++++++++++++++++++++++++ src/div_by_zero.nit | 2 +- src/frontend.nit | 8 ++------ src/highlight.nit | 1 - src/interpreter.nit | 20 ++++++++++++++++++++ src/metrics/nullables_metrics.nit | 4 +--- src/metrics/static_types_metrics.nit | 2 -- src/modelize.nit | 18 ++++++++++++++++++ src/nit.nit | 5 ++--- src/nitg.nit | 10 +--------- src/nith.nit | 12 +++--------- src/nitvm.nit | 1 + src/nitx.nit | 2 +- src/platform.nit | 2 +- src/rapid_type_analysis.nit | 3 +-- src/semantize.nit | 18 ++++++++++++++++++ src/serialization_phase.nit | 3 +-- src/test_markdown.nit | 2 +- src/testing/testing_base.nit | 2 +- src/typing.nit | 2 +- 24 files changed, 103 insertions(+), 49 deletions(-) create mode 100644 src/compiler.nit create mode 100644 src/interpreter.nit create mode 100644 src/modelize.nit create mode 100644 src/semantize.nit diff --git a/src/abstract_compiler.nit b/src/abstract_compiler.nit index 9d441cc..eb0d1d5 100644 --- a/src/abstract_compiler.nit +++ b/src/abstract_compiler.nit @@ -18,8 +18,7 @@ module abstract_compiler import literal -import typing -import auto_super_init +import semantize import platform import c_tools diff --git a/src/android_annotations.nit b/src/android_annotations.nit index ec0d2dc..b3ffcee 100644 --- a/src/android_annotations.nit +++ b/src/android_annotations.nit @@ -20,9 +20,9 @@ module android_annotations import parser_util import modelbuilder -import modelize_property +import modelize import literal -import typing +import semantize private import annotation # Metadata associated to an Android project diff --git a/src/astprinter.nit b/src/astprinter.nit index 97ff1fd..a1fd48e 100644 --- a/src/astprinter.nit +++ b/src/astprinter.nit @@ -17,8 +17,8 @@ # print AST in an human form module astprinter -import typing import phase +import semantize intrude import parser import literal diff --git a/src/cached.nit b/src/cached.nit index ead285f..67d7b98 100644 --- a/src/cached.nit +++ b/src/cached.nit @@ -18,8 +18,8 @@ # complex annotation that modify both the model and the AST of a Nit program module cached -import modelize_property import parser_util +import modelize import simple_misc_analysis private import annotation diff --git a/src/compiler.nit b/src/compiler.nit new file mode 100644 index 0000000..902a656 --- /dev/null +++ b/src/compiler.nit @@ -0,0 +1,24 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Compilation to C +module compiler + +import separate_erasure_compiler +import global_compiler +import compiler_ffi + +import android_platform +import pnacl_platform +import emscripten_platform diff --git a/src/div_by_zero.nit b/src/div_by_zero.nit index 6debbd0..318b33e 100644 --- a/src/div_by_zero.nit +++ b/src/div_by_zero.nit @@ -18,7 +18,7 @@ module div_by_zero import phase import literal # Because we need the real value of literal in the AST -import typing # Because we need the static type of receivers +import semantize # Because we need the static type of receivers # Note, `ToolContext` is the main overlord class # Among its jobs, it orchestrates and executes the various phases diff --git a/src/frontend.nit b/src/frontend.nit index 9b6e84b..cfdf85b 100644 --- a/src/frontend.nit +++ b/src/frontend.nit @@ -15,14 +15,10 @@ # Collect and orchestration of main frontend phases module frontend -import phase import simple_misc_analysis import literal -import scope -import flow -import local_var_init -import typing -import auto_super_init +import modelize +import semantize import div_by_zero import cached import serialization_phase diff --git a/src/highlight.nit b/src/highlight.nit index bfa0d0f..a93fec9 100644 --- a/src/highlight.nit +++ b/src/highlight.nit @@ -15,7 +15,6 @@ # Highliting of Nit AST module highlight -import modelize_property import frontend import html import pipeline diff --git a/src/interpreter.nit b/src/interpreter.nit new file mode 100644 index 0000000..2063760 --- /dev/null +++ b/src/interpreter.nit @@ -0,0 +1,20 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Interpretation of Nit programs +module interpreter + +import naive_interpreter +import debugger +import debugger_socket diff --git a/src/metrics/nullables_metrics.nit b/src/metrics/nullables_metrics.nit index 895f7d5..a101be9 100644 --- a/src/metrics/nullables_metrics.nit +++ b/src/metrics/nullables_metrics.nit @@ -17,11 +17,9 @@ # Statistics about the usage of nullables module nullables_metrics -import modelbuilder -private import typing import model_utils import mclasses_metrics -import frontend +import semantize redef class ToolContext var nullables_metrics_phase: Phase = new NullablesMetricsPhase(self, null) diff --git a/src/metrics/static_types_metrics.nit b/src/metrics/static_types_metrics.nit index 888c8e2..88e9555 100644 --- a/src/metrics/static_types_metrics.nit +++ b/src/metrics/static_types_metrics.nit @@ -18,8 +18,6 @@ module static_types_metrics private import metrics_base -import modelbuilder -import modelize_class import frontend redef class ToolContext diff --git a/src/modelize.nit b/src/modelize.nit new file mode 100644 index 0000000..c0ed4c9 --- /dev/null +++ b/src/modelize.nit @@ -0,0 +1,18 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Create a model from nit source files +module modelize + +import modelize_property diff --git a/src/nit.nit b/src/nit.nit index 2481ce8..6e24920 100644 --- a/src/nit.nit +++ b/src/nit.nit @@ -17,9 +17,8 @@ # A naive Nit interpreter module nit -import naive_interpreter -import debugger -import debugger_socket +import interpreter +import frontend # Create a tool context to handle options and paths var toolcontext = new ToolContext diff --git a/src/nitg.nit b/src/nitg.nit index 66cd891..69b99f0 100644 --- a/src/nitg.nit +++ b/src/nitg.nit @@ -17,17 +17,9 @@ # A global Nit compiler module nitg -import modelbuilder import frontend +import compiler import transform -import rapid_type_analysis -import global_compiler -import separate_erasure_compiler -import separate_compiler -import android_platform -import compiler_ffi -import pnacl_platform -import emscripten_platform redef class ToolContext redef fun process_options(args) diff --git a/src/nith.nit b/src/nith.nit index 6fb477d..8a052ac 100644 --- a/src/nith.nit +++ b/src/nith.nit @@ -17,17 +17,11 @@ # A ligHt Nit compiler module nith -import phase -import literal -import scope -import flow -import local_var_init -import typing -import auto_super_init -import modelbuilder +import modelize +import transform + import rapid_type_analysis import separate_erasure_compiler -import transform redef class ToolContext redef fun process_options(args) diff --git a/src/nitvm.nit b/src/nitvm.nit index c0887db..fe12c15 100644 --- a/src/nitvm.nit +++ b/src/nitvm.nit @@ -18,6 +18,7 @@ module nitvm import vm +import frontend # Create a tool context to handle options and paths var toolcontext = new ToolContext diff --git a/src/nitx.nit b/src/nitx.nit index 29be82b..218f47b 100644 --- a/src/nitx.nit +++ b/src/nitx.nit @@ -16,7 +16,7 @@ module nitx import model_utils -import modelize_property +import modelize # Main class of the nit index tool # NitIndex build the model using the toolcontext argument diff --git a/src/platform.nit b/src/platform.nit index 9e3e92e..99d67a0 100644 --- a/src/platform.nit +++ b/src/platform.nit @@ -16,9 +16,9 @@ # to the target platform. Also detects conflicts between targetted platforms. module platform -import modelize_property import parser_util import modelbuilder +import modelize private import annotation redef class ToolContext diff --git a/src/rapid_type_analysis.nit b/src/rapid_type_analysis.nit index 6518860..418bc15 100644 --- a/src/rapid_type_analysis.nit +++ b/src/rapid_type_analysis.nit @@ -25,8 +25,7 @@ module rapid_type_analysis import model import modelbuilder -import typing -import auto_super_init +import semantize import csv # for live_types_to_csv import ordered_tree # for live_methods_to_tree diff --git a/src/semantize.nit b/src/semantize.nit new file mode 100644 index 0000000..cf01ce9 --- /dev/null +++ b/src/semantize.nit @@ -0,0 +1,18 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Process bodies of methods in regard with the model. +module semantize + +import auto_super_init diff --git a/src/serialization_phase.nit b/src/serialization_phase.nit index ec472c2..1847298 100644 --- a/src/serialization_phase.nit +++ b/src/serialization_phase.nit @@ -21,8 +21,7 @@ module serialization_phase import phase import parser_util -import modelize_property -intrude import modelize_class +import modelize redef class ToolContext var serialization_phase_pre_model: Phase = new SerializationPhasePreModel(self, null) diff --git a/src/test_markdown.nit b/src/test_markdown.nit index 6e6ccc3..9d73b67 100644 --- a/src/test_markdown.nit +++ b/src/test_markdown.nit @@ -15,7 +15,7 @@ # Program to test the `markdown` module on real source files. module test_markdown -import modelize_property +import modelize import highlight import markdown diff --git a/src/testing/testing_base.nit b/src/testing/testing_base.nit index 243a51e..ef9e7fe 100644 --- a/src/testing/testing_base.nit +++ b/src/testing/testing_base.nit @@ -15,8 +15,8 @@ # Base options for testing tools. module testing_base -import modelize_property import parser_util +import modelize redef class ToolContext # opt --full diff --git a/src/typing.nit b/src/typing.nit index a415667..3dd9024 100644 --- a/src/typing.nit +++ b/src/typing.nit @@ -19,8 +19,8 @@ module typing import flow -import modelize_property import phase +import modelize import local_var_init redef class ToolContext -- 1.7.9.5