diff --git a/compiler/ast.nim b/compiler/ast/ast.nim similarity index 99% rename from compiler/ast.nim rename to compiler/ast/ast.nim index d4b6a601431..64d180e8f8f 100644 --- a/compiler/ast.nim +++ b/compiler/ast/ast.nim @@ -10,14 +10,25 @@ ## abstract syntax tree + symbol table import - lineinfos, hashes, options, ropes, idents, int128, tables - -from strutils import toLowerAscii - -import ./ast_types -export ast_types - -export int128 + compiler/ast/[ + lineinfos, # Positional information + idents, # Ast identifiers + ast_types # Main ast type definitions + ], + compiler/front/[ + options + ], + compiler/utils/[ + ropes, + int128 # Values for integer nodes + ], + std/[ + hashes, + strutils, + tables # For symbol table mapping + ] + +export ast_types, int128 template nodeId(n: PNode): int = cast[int](n) diff --git a/compiler/ast_types.nim b/compiler/ast/ast_types.nim similarity index 99% rename from compiler/ast_types.nim rename to compiler/ast/ast_types.nim index 24d61a21bbb..aaf9163933a 100644 --- a/compiler/ast_types.nim +++ b/compiler/ast/ast_types.nim @@ -1,4 +1,4 @@ -import ropes +import compiler/utils/ropes import std/[hashes] const diff --git a/compiler/astalgo.nim b/compiler/ast/astalgo.nim similarity index 99% rename from compiler/astalgo.nim rename to compiler/ast/astalgo.nim index dcd0d2d861a..a3599e3f2d0 100644 --- a/compiler/astalgo.nim +++ b/compiler/ast/astalgo.nim @@ -12,8 +12,26 @@ # the data structures here are used in various places of the compiler. import - ast, hashes, intsets, strutils, options, lineinfos, ropes, idents, rodutils, - msgs + compiler/ast/[ + ast, + idents, + lineinfos, + ], + std/[ + hashes, + intsets, + strutils, + ], + compiler/utils/[ + ropes, + ], + compiler/sem/[ + rodutils, + ], + compiler/front/[ + options, + msgs + ] proc hashNode*(p: RootRef): Hash proc treeToYaml*(conf: ConfigRef; n: PNode, indent: int = 0, maxRecDepth: int = - 1): Rope diff --git a/compiler/astmsgs.nim b/compiler/ast/astmsgs.nim similarity index 95% rename from compiler/astmsgs.nim rename to compiler/ast/astmsgs.nim index 11a8d757f2e..93e90cd3f1b 100644 --- a/compiler/astmsgs.nim +++ b/compiler/ast/astmsgs.nim @@ -1,6 +1,13 @@ # this module avoids ast depending on msgs or vice versa import std/strutils -import options, ast, msgs +import + compiler/ast/[ + ast, + ], + compiler/front/[ + options, + msgs + ] proc typSym*(t: PType): PSym = result = t.sym diff --git a/compiler/enumtostr.nim b/compiler/ast/enumtostr.nim similarity index 96% rename from compiler/enumtostr.nim rename to compiler/ast/enumtostr.nim index 9bfa7001a9d..80ee14a242c 100644 --- a/compiler/enumtostr.nim +++ b/compiler/ast/enumtostr.nim @@ -1,5 +1,14 @@ +import + compiler/ast/[ + ast, + idents, + lineinfos + ], + compiler/modules/[ + modulegraphs, + magicsys + ] -import ast, idents, lineinfos, modulegraphs, magicsys proc genEnumToStrProc*(t: PType; info: TLineInfo; g: ModuleGraph; idgen: IdGenerator): PSym = result = newSym(skProc, getIdent(g.cache, "$"), nextSymId idgen, t.owner, info) diff --git a/compiler/errorhandling.nim b/compiler/ast/errorhandling.nim similarity index 97% rename from compiler/errorhandling.nim rename to compiler/ast/errorhandling.nim index 7ab63dc249d..3ff864f6941 100644 --- a/compiler/errorhandling.nim +++ b/compiler/ast/errorhandling.nim @@ -31,9 +31,19 @@ ## * rework internals to store actual error information in a lookup data ## structure on the side instead of directly in the node -import ast, msgs, options -from lineinfos import unknownLineInfo -import reports, debugutils +import + compiler/ast/[ + ast, + reports, + lineinfos + ], + compiler/utils/[ + debugutils, + ], + compiler/front/[ + msgs, + options + ] proc errorSubNode*(n: PNode): PNode = ## find the first error node, or nil, under `n` using a depth first traversal diff --git a/compiler/errorreporting.nim b/compiler/ast/errorreporting.nim similarity index 93% rename from compiler/errorreporting.nim rename to compiler/ast/errorreporting.nim index 0a62b219312..bad60891fcb 100644 --- a/compiler/errorreporting.nim +++ b/compiler/ast/errorreporting.nim @@ -14,8 +14,8 @@ ## determines which error handling strategy to use doNothing, raise, etc. import ast, errorhandling, renderer, reports -from options import ConfigRef -from msgs import TErrorHandling +from compiler/front/options import ConfigRef +from compiler/front/msgs import TErrorHandling export compilerInstInfo, walkErrors, errorKind # export because keeping the declaration in `errorhandling` acts as a reminder diff --git a/compiler/filter_tmpl.nim b/compiler/ast/filter_tmpl.nim similarity index 97% rename from compiler/filter_tmpl.nim rename to compiler/ast/filter_tmpl.nim index 41be25c2667..33c1fab3d3e 100644 --- a/compiler/filter_tmpl.nim +++ b/compiler/ast/filter_tmpl.nim @@ -10,8 +10,23 @@ ## This module implements Nim's standard template filter. import - llstream, strutils, ast, msgs, options, - filters, lineinfos, pathutils, reports + compiler/front/[ + msgs, + options, + ], + std/[ + strutils, + ], + compiler/utils/[ + pathutils, + ], + compiler/ast/[ + llstream, + ast, + filters, + lineinfos, + reports + ] type TParseState = enum diff --git a/compiler/filters.nim b/compiler/ast/filters.nim similarity index 93% rename from compiler/filters.nim rename to compiler/ast/filters.nim index 2fcdb90d072..62c0a36978c 100644 --- a/compiler/filters.nim +++ b/compiler/ast/filters.nim @@ -10,8 +10,23 @@ ## This module implements Nim's simple filters and helpers for filters. import - llstream, strutils, ast, msgs, options, - renderer, pathutils, reports + compiler/ast/[ + llstream, + ast, + renderer, + reports + ], + std/[ + strutils, + ], + compiler/utils/[ + pathutils, + ], + compiler/front/[ + msgs, + options, + ] + proc invalidPragma(conf: ConfigRef; n: PNode) = conf.localReport(n.info, reportAst(rsemNodeNotAllowed, n)) diff --git a/compiler/idents.nim b/compiler/ast/idents.nim similarity index 100% rename from compiler/idents.nim rename to compiler/ast/idents.nim diff --git a/compiler/layouter.nim b/compiler/ast/layouter.nim similarity index 100% rename from compiler/layouter.nim rename to compiler/ast/layouter.nim diff --git a/compiler/lexer.nim b/compiler/ast/lexer.nim similarity index 99% rename from compiler/lexer.nim rename to compiler/ast/lexer.nim index 3470105e6ea..84c0f98260d 100644 --- a/compiler/lexer.nim +++ b/compiler/ast/lexer.nim @@ -17,8 +17,27 @@ ## format. import - hashes, options, msgs, strutils, platform, idents, nimlexbase, llstream, - wordrecg, lineinfos, pathutils, parseutils, reports + compiler/utils/[ + platform, + pathutils, + ], + compiler/ast/[ + wordrecg, + nimlexbase, + llstream, + lineinfos, + reports, + idents + ], + std/[ + parseutils, + hashes, + strutils + ], + compiler/front/[ + options, + msgs + ] const MaxLineLength* = 80 # lines longer than this lead to a warning diff --git a/compiler/lineinfos.nim b/compiler/ast/lineinfos.nim similarity index 99% rename from compiler/lineinfos.nim rename to compiler/ast/lineinfos.nim index 327cfa7609e..6c5722a5d88 100644 --- a/compiler/lineinfos.nim +++ b/compiler/ast/lineinfos.nim @@ -10,7 +10,9 @@ ## This module contains the ``TMsgKind`` enum as well as the ## ``TLineInfo`` object. -import ropes, tables, pathutils, hashes +import + std/[tables, hashes], + compiler/utils/[ropes, pathutils] from ast_types import PSym, # Contextual details of the instantnation stack optionally refer to diff --git a/compiler/linter.nim b/compiler/ast/linter.nim similarity index 97% rename from compiler/linter.nim rename to compiler/ast/linter.nim index 9e51586fe5f..1192643d7e0 100644 --- a/compiler/linter.nim +++ b/compiler/ast/linter.nim @@ -8,9 +8,21 @@ # ## This module implements the style checker. +import + std/[ + strutils + ], + compiler/ast/[ + ast, + lineinfos, + wordrecg, + reports + ], + compiler/front/[ + options, + msgs + ] -import std/strutils -import options, ast, msgs, lineinfos, wordrecg, reports const Letters* = {'a'..'z', 'A'..'Z', '0'..'9', '\x80'..'\xFF', '_'} diff --git a/compiler/llstream.nim b/compiler/ast/llstream.nim similarity index 99% rename from compiler/llstream.nim rename to compiler/ast/llstream.nim index 865a98ee0d4..ea69ac8ab2c 100644 --- a/compiler/llstream.nim +++ b/compiler/ast/llstream.nim @@ -10,7 +10,7 @@ ## Low-level streams for high performance. import - pathutils + compiler/utils/pathutils # support `useGnuReadline`, `useLinenoise` for backwards compatibility const hasRstdin = (defined(nimUseLinenoise) or defined(useLinenoise) or defined(useGnuReadline)) and diff --git a/compiler/ndi.nim b/compiler/ast/ndi.nim similarity index 90% rename from compiler/ndi.nim rename to compiler/ast/ndi.nim index 5af87237f94..e8a6e1bb1bc 100644 --- a/compiler/ndi.nim +++ b/compiler/ast/ndi.nim @@ -10,7 +10,18 @@ ## This module implements the generation of ``.ndi`` files for better debugging ## support of Nim code. "ndi" stands for "Nim debug info". -import ast, msgs, ropes, options, pathutils +import + compiler/ast/[ + ast + ], + compiler/front/[ + msgs, + options + ], + compiler/utils/[ + ropes, + pathutils + ] type NdiFile* = object diff --git a/compiler/nimlexbase.nim b/compiler/ast/nimlexbase.nim similarity index 100% rename from compiler/nimlexbase.nim rename to compiler/ast/nimlexbase.nim diff --git a/compiler/nimsets.nim b/compiler/ast/nimsets.nim similarity index 97% rename from compiler/nimsets.nim rename to compiler/ast/nimsets.nim index 8683604af2a..ed41df9b0ce 100644 --- a/compiler/nimsets.nim +++ b/compiler/ast/nimsets.nim @@ -10,7 +10,13 @@ # this unit handles Nim sets; it implements symbolic sets import - ast, astalgo, lineinfos, bitsets, types, options + compiler/ast/[ast, astalgo, lineinfos, types], + compiler/front/[ + options + ], + compiler/utils/[ + bitsets + ] proc inSet*(s: PNode, elem: PNode): bool = assert s.kind == nkCurly diff --git a/compiler/parser.nim b/compiler/ast/parser.nim similarity index 99% rename from compiler/parser.nim rename to compiler/ast/parser.nim index b74e9e291a7..4c588f1bb6b 100644 --- a/compiler/parser.nim +++ b/compiler/ast/parser.nim @@ -30,8 +30,24 @@ when isMainModule: checkGrammarFile() import - llstream, lexer, idents, strutils, ast, msgs, options, lineinfos, - pathutils, reports + compiler/ast/[ + llstream, + lexer, + idents, + ast, + lineinfos, + reports + ], + std/[ + strutils, + ], + compiler/front/[ + msgs, + options, + ], + compiler/utils/[ + pathutils + ] when defined(nimpretty): import layouter diff --git a/compiler/renderer.nim b/compiler/ast/renderer.nim similarity index 99% rename from compiler/renderer.nim rename to compiler/ast/renderer.nim index c265fb7be0c..a7be83460bd 100644 --- a/compiler/renderer.nim +++ b/compiler/ast/renderer.nim @@ -15,7 +15,21 @@ when defined(nimHasUsed): {.used.} import - lexer, options, idents, strutils, ast, msgs, lineinfos, reports + compiler/ast/[ + lexer, + idents, + ast, + lineinfos, + reports + ], + std/[ + strutils, + ], + compiler/front/[ + options, + msgs, + ] + type TRenderFlag* = enum diff --git a/compiler/reports.nim b/compiler/ast/reports.nim similarity index 99% rename from compiler/reports.nim rename to compiler/ast/reports.nim index eda5aaba73f..75c4340471c 100644 --- a/compiler/reports.nim +++ b/compiler/ast/reports.nim @@ -17,10 +17,10 @@ import std/[options, packedsets] import - ast_types, - vm_enums, - nilcheck_enums, - int128 + compiler/vm/vm_enums, + compiler/ast/ast_types, + compiler/utils/int128, + compiler/sem/nilcheck_enums export ast_types, diff --git a/compiler/syntaxes.nim b/compiler/ast/syntaxes.nim similarity index 94% rename from compiler/syntaxes.nim rename to compiler/ast/syntaxes.nim index 4ef6daeb0de..d6054de56a0 100644 --- a/compiler/syntaxes.nim +++ b/compiler/ast/syntaxes.nim @@ -10,8 +10,26 @@ ## Implements the dispatcher for the different parsers. import - strutils, llstream, ast, idents, lexer, options, msgs, parser, - filters, filter_tmpl, renderer, lineinfos, pathutils, reports + strutils, + compiler/ast/[ + llstream, + ast, + idents, + lexer, + parser, + filters, + filter_tmpl, + renderer, + lineinfos, + reports + ], + compiler/front/[ + options, + msgs, + ], + compiler/utils/[ + pathutils, + ] export Parser, parseAll, parseTopLevelStmt, closeParser diff --git a/compiler/trees.nim b/compiler/ast/trees.nim similarity index 100% rename from compiler/trees.nim rename to compiler/ast/trees.nim diff --git a/compiler/treetab.nim b/compiler/ast/treetab.nim similarity index 100% rename from compiler/treetab.nim rename to compiler/ast/treetab.nim diff --git a/compiler/types.nim b/compiler/ast/types.nim similarity index 99% rename from compiler/types.nim rename to compiler/ast/types.nim index e11761f5bc4..c334ba8fff5 100644 --- a/compiler/types.nim +++ b/compiler/ast/types.nim @@ -10,8 +10,31 @@ # this module contains routines for accessing and iterating over types import - intsets, ast, astalgo, trees, msgs, strutils, platform, renderer, options, - lineinfos, int128, modulegraphs, astmsgs, errorhandling, reports + std/[ + intsets, + strutils, + ], + compiler/ast/[ + ast, + astalgo, + trees, + renderer, + lineinfos, + astmsgs, + errorhandling, + reports + ], + compiler/front/[ + msgs, + options, + ], + compiler/utils/[ + platform, + int128, + ], + compiler/modules/[ + modulegraphs, + ] export EffectsCompat, TTypeRelation, ProcConvMismatch @@ -1300,7 +1323,7 @@ proc matchType*(a: PType, pattern: openArray[tuple[k:TTypeKind, i:int]], result = a.kind == last -include sizealignoffsetimpl +include compiler/sem/sizealignoffsetimpl proc computeSize*(conf: ConfigRef; typ: PType): BiggestInt = computeSizeAlign(conf, typ) diff --git a/compiler/typesrenderer.nim b/compiler/ast/typesrenderer.nim similarity index 100% rename from compiler/typesrenderer.nim rename to compiler/ast/typesrenderer.nim diff --git a/compiler/wordrecg.nim b/compiler/ast/wordrecg.nim similarity index 100% rename from compiler/wordrecg.nim rename to compiler/ast/wordrecg.nim diff --git a/compiler/ccgcalls.nim b/compiler/backend/ccgcalls.nim similarity index 100% rename from compiler/ccgcalls.nim rename to compiler/backend/ccgcalls.nim diff --git a/compiler/ccgexprs.nim b/compiler/backend/ccgexprs.nim similarity index 100% rename from compiler/ccgexprs.nim rename to compiler/backend/ccgexprs.nim diff --git a/compiler/ccgliterals.nim b/compiler/backend/ccgliterals.nim similarity index 100% rename from compiler/ccgliterals.nim rename to compiler/backend/ccgliterals.nim diff --git a/compiler/ccgmerge_unused.nim b/compiler/backend/ccgmerge_unused.nim similarity index 100% rename from compiler/ccgmerge_unused.nim rename to compiler/backend/ccgmerge_unused.nim diff --git a/compiler/ccgreset.nim b/compiler/backend/ccgreset.nim similarity index 100% rename from compiler/ccgreset.nim rename to compiler/backend/ccgreset.nim diff --git a/compiler/ccgstmts.nim b/compiler/backend/ccgstmts.nim similarity index 100% rename from compiler/ccgstmts.nim rename to compiler/backend/ccgstmts.nim diff --git a/compiler/ccgthreadvars.nim b/compiler/backend/ccgthreadvars.nim similarity index 100% rename from compiler/ccgthreadvars.nim rename to compiler/backend/ccgthreadvars.nim diff --git a/compiler/ccgtrav.nim b/compiler/backend/ccgtrav.nim similarity index 100% rename from compiler/ccgtrav.nim rename to compiler/backend/ccgtrav.nim diff --git a/compiler/ccgtypes.nim b/compiler/backend/ccgtypes.nim similarity index 100% rename from compiler/ccgtypes.nim rename to compiler/backend/ccgtypes.nim diff --git a/compiler/ccgutils.nim b/compiler/backend/ccgutils.nim similarity index 94% rename from compiler/ccgutils.nim rename to compiler/backend/ccgutils.nim index 06b75a20fa6..d2892953ca1 100644 --- a/compiler/ccgutils.nim +++ b/compiler/backend/ccgutils.nim @@ -10,8 +10,27 @@ # This module declares some helpers for the C code generator. import - ast, types, hashes, strutils, msgs, wordrecg, - platform, trees, options, cgendata + std/[ + hashes, strutils + ], + compiler/ast/[ + wordrecg, + ast, + types, + trees + ], + compiler/front/[ + msgs, + options + ], + compiler/utils/[ + platform + ], + compiler/sem/[ + ], + compiler/backend/[ + cgendata + ] proc getPragmaStmt*(n: PNode, w: TSpecialWord): PNode = case n.kind diff --git a/compiler/cgen.nim b/compiler/backend/cgen.nim similarity index 100% rename from compiler/cgen.nim rename to compiler/backend/cgen.nim diff --git a/compiler/cgendata.nim b/compiler/backend/cgendata.nim similarity index 97% rename from compiler/cgendata.nim rename to compiler/backend/cgendata.nim index 88b8d4090dd..fc22e9347e8 100644 --- a/compiler/cgendata.nim +++ b/compiler/backend/cgendata.nim @@ -10,8 +10,27 @@ ## This module contains the data structures for the C code generation phase. import - ast, ropes, options, intsets, - tables, ndi, lineinfos, pathutils, modulegraphs, sets + std/[ + intsets, + tables, + sets + ], + compiler/ast/[ + ast, + lineinfos, + ndi + ], + compiler/modules/[ + modulegraphs + ], + compiler/front/[ + options + ], + compiler/utils/[ + ropes, + pathutils + ] + type TLabel* = Rope # for the C generator a label is just a rope diff --git a/compiler/cgmeth.nim b/compiler/backend/cgmeth.nim similarity index 97% rename from compiler/cgmeth.nim rename to compiler/backend/cgmeth.nim index 976a9cbbcd5..7f78dc7a0a5 100644 --- a/compiler/cgmeth.nim +++ b/compiler/backend/cgmeth.nim @@ -10,8 +10,27 @@ ## This module implements code generation for methods. import - intsets, options, ast, msgs, renderer, types, magicsys, - sempass2, modulegraphs, lineinfos, reports + std/[ + intsets, + ], + compiler/front/[ + options, + msgs, + ], + compiler/ast/[ + ast, + renderer, + types, + lineinfos, + reports + ], + compiler/modules/[ + magicsys, + modulegraphs, + ], + compiler/sem/[ + sempass2, + ] proc genConv(n: PNode, d: PType, downcast: bool; conf: ConfigRef): PNode = var dest = skipTypes(d, abstractPtrs) diff --git a/compiler/extccomp.nim b/compiler/backend/extccomp.nim similarity index 99% rename from compiler/extccomp.nim rename to compiler/backend/extccomp.nim index 82dffbc00a0..59b41c98848 100644 --- a/compiler/extccomp.nim +++ b/compiler/backend/extccomp.nim @@ -12,10 +12,18 @@ ## options read from a lineinfos file, to provide generalized procedures to ## compile nim files. -import ropes, platform, condsyms, options, msgs, lineinfos, pathutils, reports +import + compiler/utils/[ropes, platform, pathutils], + compiler/ast/[lineinfos, reports], + compiler/front/[condsyms, options, msgs], + std/[ + os, strutils, osproc, sha1, streams, sequtils, + times, strtabs, json, jsonutils, sugar + ] + +# import ropes, platform, condsyms, options, msgs, lineinfos, pathutils, reports -import std/[os, strutils, osproc, sha1, streams, sequtils, times, strtabs, json, jsonutils, sugar] type TInfoCCProp* = enum ## properties of the C compiler: diff --git a/compiler/jsgen.nim b/compiler/backend/jsgen.nim similarity index 100% rename from compiler/jsgen.nim rename to compiler/backend/jsgen.nim diff --git a/compiler/jstypes.nim b/compiler/backend/jstypes.nim similarity index 100% rename from compiler/jstypes.nim rename to compiler/backend/jstypes.nim diff --git a/compiler/tccgen.nim b/compiler/backend/tccgen.nim similarity index 100% rename from compiler/tccgen.nim rename to compiler/backend/tccgen.nim diff --git a/compiler/cli_reporter.nim b/compiler/front/cli_reporter.nim similarity index 100% rename from compiler/cli_reporter.nim rename to compiler/front/cli_reporter.nim diff --git a/compiler/cmdlinehelper.nim b/compiler/front/cmdlinehelper.nim similarity index 100% rename from compiler/cmdlinehelper.nim rename to compiler/front/cmdlinehelper.nim diff --git a/compiler/commands.nim b/compiler/front/commands.nim similarity index 99% rename from compiler/commands.nim rename to compiler/front/commands.nim index 4cb4e75bdc3..8f0f528b8b3 100644 --- a/compiler/commands.nim +++ b/compiler/front/commands.nim @@ -24,13 +24,40 @@ bootSwitch(usedMarkAndSweep, defined(gcmarkandsweep), "--gc:markAndSweep") bootSwitch(usedGoGC, defined(gogc), "--gc:go") bootSwitch(usedNoGC, defined(nogc), "--gc:none") -import std/[os, strutils, parseutils, parseopt, sequtils, strtabs] import - msgs, options, nversion, condsyms, extccomp, platform, - wordrecg, nimblecmd, lineinfos, pathutils, pathnorm, - reports - -from ast import setUseIc, eqTypeFlags, tfGcSafe, tfNoSideEffect + std/[ + os, + strutils, + parseutils, + parseopt, + sequtils, + strtabs, + pathnorm + ], + compiler/modules/[ + nimblecmd, + ], + compiler/ast/[ + lineinfos, + reports, + wordrecg, + ], + compiler/front/[ + condsyms, + options, + msgs + ], + compiler/backend/[ + extccomp + ], + compiler/utils/[ + nversion, + pathutils, + platform + ] + + +from compiler/ast/ast import setUseIc, eqTypeFlags, tfGcSafe, tfNoSideEffect bootSwitch(usedTinyC, hasTinyCBackend, "-d:tinyc") bootSwitch(usedFFI, hasFFI, "-d:nimHasLibFFI") diff --git a/compiler/condsyms.nim b/compiler/front/condsyms.nim similarity index 99% rename from compiler/condsyms.nim rename to compiler/front/condsyms.nim index 9c0d64fc53f..b8f4ec945aa 100644 --- a/compiler/condsyms.nim +++ b/compiler/front/condsyms.nim @@ -10,10 +10,10 @@ # This module handles the conditional symbols. import - strtabs + std/strtabs from options import Feature -import reports +import compiler/ast/reports proc defineSymbol*(symbols: StringTableRef; symbol: string, value: string = "true") = symbols[symbol] = value diff --git a/compiler/main.nim b/compiler/front/main.nim similarity index 93% rename from compiler/main.nim rename to compiler/front/main.nim index 7c891b78d80..2917de1ccf9 100644 --- a/compiler/main.nim +++ b/compiler/front/main.nim @@ -14,14 +14,50 @@ when not defined(nimcore): import std/[strutils, os, times, tables, sha1, with, json], - llstream, ast, lexer, syntaxes, options, msgs, - condsyms, - sem, idents, passes, extccomp, - cgen, nversion, - platform, nimconf, passaux, depends, vm, - modules, - reports, - modulegraphs, lineinfos, pathutils, vmprofiler + compiler/ast/[ + llstream, # Input data stream + ast, + lexer, + reports, # Error report information + lineinfos # Positional data + ], + compiler/front/[ + options, + msgs, + nimconf # Configuration file reading + ], + compiler/sem/[ + sem, # Semantic passes + idents, + passes, + passaux + ], + compiler/modules/[ + depends, # Generate dependency information + modulegraphs # Project module graph + ], + compiler/backend/[ + extccomp, # Calling C compiler + cgen, # C code generation + ], + compiler/utils/[ + platform, # Target platform data + pathutils # Input file handling + ], + compiler/vm/[ + vm, # Configuration file evaluation, `nim e` + vmprofiler + ] + + + # llstream, ast, lexer, syntaxes, options, msgs, + # condsyms, + # sem, idents, passes, extccomp, + # cgen, nversion, + # platform, nimconf, passaux, depends, vm, + # modules, + # reports, + # modulegraphs, lineinfos, pathutils, vmprofiler import ic / [cbackend, integrity, navigator] from ic / ic import rodViewer diff --git a/compiler/msgs.nim b/compiler/front/msgs.nim similarity index 99% rename from compiler/msgs.nim rename to compiler/front/msgs.nim index 271b51a881f..098a8aed01f 100644 --- a/compiler/msgs.nim +++ b/compiler/front/msgs.nim @@ -15,9 +15,11 @@ import std/options as std_options import - options, ropes, lineinfos, pathutils, strutils2, reports + compiler/utils/[ropes, pathutils, strutils2], + compiler/ast/[reports, lineinfos], + compiler/front/[options] -from ast_types import PSym +from compiler/ast/ast_types import PSym export InstantiationInfo export TErrorHandling diff --git a/compiler/nimconf.nim b/compiler/front/nimconf.nim similarity index 97% rename from compiler/nimconf.nim rename to compiler/front/nimconf.nim index 50f3289fbc2..e9a43001bc2 100644 --- a/compiler/nimconf.nim +++ b/compiler/front/nimconf.nim @@ -10,8 +10,29 @@ # This module handles the reading of the config file. import - llstream, commands, os, strutils, msgs, lexer, ast, reports, - options, idents, wordrecg, strtabs, pathutils, scriptconfig + compiler/ast/[ + llstream, + ], + compiler/front/[ + commands, + msgs, + options, + scriptconfig + ], + compiler/ast/[ + lexer, + reports, + idents, + wordrecg, + ], + std/[ + os, + strutils, + strtabs, + ], + compiler/utils/[ + pathutils, + ] # ---------------- configuration file parser ----------------------------- # we use Nim's lexer here to save space and work diff --git a/compiler/options.nim b/compiler/front/options.nim similarity index 99% rename from compiler/options.nim rename to compiler/front/options.nim index 1a4965c2a0d..5575c2e09ed 100644 --- a/compiler/options.nim +++ b/compiler/front/options.nim @@ -8,12 +8,12 @@ # import - os, strutils, strtabs, sets, lineinfos, platform, - prefixmatches, pathutils, nimpaths, tables, reports + std/[os, strutils, strtabs, sets, tables], + compiler/utils/[prefixmatches, pathutils, platform], + compiler/ast/[reports, lineinfos], + compiler/modules/nimpaths -import std/options as sopt - -from ast_types import TOption, TOptions +from compiler/ast/ast_types import TOption, TOptions export TOption, TOptions from terminal import isatty @@ -1092,7 +1092,7 @@ proc clearNimblePath*(conf: ConfigRef) = conf.lazyPaths.setLen(0) conf.nimblePaths.setLen(0) -include packagehandling +include compiler/modules/packagehandling proc getOsCacheDir(): string = when defined(posix): diff --git a/compiler/scriptconfig.nim b/compiler/front/scriptconfig.nim similarity index 94% rename from compiler/scriptconfig.nim rename to compiler/front/scriptconfig.nim index d3d2a74e78e..06714eaa920 100644 --- a/compiler/scriptconfig.nim +++ b/compiler/front/scriptconfig.nim @@ -11,13 +11,43 @@ ## language. import - ast, modules, idents, passes, condsyms, - options, sem, llstream, vm, vmdef, commands, - os, times, osproc, wordrecg, strtabs, modulegraphs, - pathutils, reports, msgs + compiler/ast/[ + ast, + idents, + wordrecg, + reports, + llstream, + ], + std/[ + os, + times, + osproc, + strtabs, + ], + compiler/modules/[ + modules, + modulegraphs, + ], + compiler/sem/[ + passes, + sem, + ], + compiler/vm/[ + vm, + vmdef, + ], + compiler/front/[ + msgs, + condsyms, + options, + commands, + ], + compiler/utils/[ + pathutils + ] # we support 'cmpIgnoreStyle' natively for efficiency: -from strutils import cmpIgnoreStyle, contains +from std/strutils import cmpIgnoreStyle, contains proc listDirs(a: VmArgs, filter: set[PathComponent]) = let dir = getString(a, 0) diff --git a/compiler/ic/ic.nim b/compiler/ic/ic.nim index 818fbe73531..7e7501e894b 100644 --- a/compiler/ic/ic.nim +++ b/compiler/ic/ic.nim @@ -7,12 +7,31 @@ # distribution, for details about the copyright. # -import hashes, tables, intsets, std/sha1 -import packed_ast, bitabs, rodfiles -import ".." / [ast, idents, lineinfos, msgs, ropes, options, - pathutils, condsyms, reports] -#import ".." / [renderer, astalgo] -from os import removeFile, isAbsolute +import std/[hashes, tables, intsets, sha1] + +import + compiler/ic/[ + packed_ast, + bitabs, + rodfiles + ], + compiler/ast/[ + ast, + idents, + lineinfos, + reports + ], + compiler/front/[ + msgs, + options, + condsyms + ], + compiler/utils/[ + ropes, + pathutils + ] + +from std/os import removeFile, isAbsolute type PackedConfig* = object diff --git a/compiler/ic/packed_ast.nim b/compiler/ic/packed_ast.nim index 17beda2c18b..afc2ba5d479 100644 --- a/compiler/ic/packed_ast.nim +++ b/compiler/ic/packed_ast.nim @@ -12,9 +12,9 @@ ## use this representation directly in all the transformations, ## it is superior. -import hashes, tables, strtabs -import bitabs -import ".." / [ast, options] +import std/[hashes, tables, strtabs] +import compiler/ic/bitabs +import compiler/ast/ast, compiler/front/options type SymId* = distinct int32 diff --git a/compiler/ic/replayer.nim b/compiler/ic/replayer.nim index aee20a6c88f..11a5b2580fb 100644 --- a/compiler/ic/replayer.nim +++ b/compiler/ic/replayer.nim @@ -11,8 +11,27 @@ ## state like ``{.compile: "foo.c".}``. For IC (= Incremental compilation) ## support. -import ".." / [ast, modulegraphs, trees, extccomp, btrees, - msgs, pathutils, options, cgmeth, reports] +import + compiler/ast/[ + ast, + trees, + reports, + ], + compiler/modules/[ + modulegraphs, + ], + compiler/utils/[ + btrees, + pathutils, + ], + compiler/front/[ + msgs, + options, + ], + compiler/backend/[ + extccomp, + cgmeth + ] import tables diff --git a/compiler/depends.nim b/compiler/modules/depends.nim similarity index 100% rename from compiler/depends.nim rename to compiler/modules/depends.nim diff --git a/compiler/importer.nim b/compiler/modules/importer.nim similarity index 97% rename from compiler/importer.nim rename to compiler/modules/importer.nim index ccdbf6f6ee7..a9377c32b03 100644 --- a/compiler/importer.nim +++ b/compiler/modules/importer.nim @@ -10,9 +10,32 @@ ## This module implements the symbol importing mechanism. import - intsets, ast, astalgo, msgs, options, idents, lookups, - semdata, modulepaths, sigmatch, lineinfos, sets, - modulegraphs, wordrecg, tables, reports + std/[ + intsets, + sets, + tables + ], + compiler/ast/[ + ast, + astalgo, + idents, + lineinfos, + wordrecg, + reports + ], + compiler/modules/[ + modulepaths, + modulegraphs + ], + compiler/front/[ + msgs, + options + ], + compiler/sem/[ + lookups, + semdata, + sigmatch + ] proc readExceptSet*(c: PContext, n: PNode): IntSet = assert n.kind in {nkImportExceptStmt, nkExportExceptStmt} diff --git a/compiler/magicsys.nim b/compiler/modules/magicsys.nim similarity index 95% rename from compiler/magicsys.nim rename to compiler/modules/magicsys.nim index 620891c7f83..503bfd5b6df 100644 --- a/compiler/magicsys.nim +++ b/compiler/modules/magicsys.nim @@ -7,11 +7,27 @@ # distribution, for details about the copyright. # -# Built-in types and compilerprocs are registered here. +## Built-in types and compilerprocs are registered here. import - ast, astalgo, msgs, platform, idents, reports, - modulegraphs, lineinfos, errorhandling, options + compiler/utils/[ + platform, + ], + compiler/ast/[ + lineinfos, + errorhandling, + idents, + reports, + ast, + astalgo, + ], + compiler/modules/[ + modulegraphs, + ], + compiler/front/[ + msgs, + options + ] export createMagic diff --git a/compiler/modulegraphs.nim b/compiler/modules/modulegraphs.nim similarity index 98% rename from compiler/modulegraphs.nim rename to compiler/modules/modulegraphs.nim index 4668e1e79d2..c8cde2af1a8 100644 --- a/compiler/modulegraphs.nim +++ b/compiler/modules/modulegraphs.nim @@ -11,10 +11,33 @@ ## represents a complete Nim project. Single modules can either be kept in RAM ## or stored in a rod-file. -import intsets, tables, hashes, md5 -import ast, astalgo, options, lineinfos,idents, - btrees, ropes, msgs, pathutils, reports -import ic / [packed_ast, ic] +import + std/[ + intsets, + tables, + hashes, + md5 + ], + compiler/front/[ + options, + msgs, + ], + compiler/ast/[ + ast, + astalgo, + lineinfos, + idents, + reports + ], + compiler/utils/[ + pathutils, + btrees, + ropes, + ], + compiler/ic/[ + packed_ast, + ic + ] type SigHash* = distinct MD5Digest diff --git a/compiler/modulepaths.nim b/compiler/modules/modulepaths.nim similarity index 96% rename from compiler/modulepaths.nim rename to compiler/modules/modulepaths.nim index 2a35a9413df..b13972af5b9 100644 --- a/compiler/modulepaths.nim +++ b/compiler/modules/modulepaths.nim @@ -7,8 +7,25 @@ # distribution, for details about the copyright. # -import ast, renderer, strutils, msgs, options, os, lineinfos, - pathutils, reports +import + std/[ + strutils, + os, + ], + compiler/ast/[ + ast, + lineinfos, + renderer, + reports, + ], + compiler/utils/[ + pathutils, + ], + compiler/front/[ + msgs, + options, + ] + when false: const diff --git a/compiler/modules.nim b/compiler/modules/modules.nim similarity index 95% rename from compiler/modules.nim rename to compiler/modules/modules.nim index a5a79cb234e..bfa115b02bd 100644 --- a/compiler/modules.nim +++ b/compiler/modules/modules.nim @@ -10,11 +10,37 @@ ## Implements the module handling, including the caching of modules. import - ast, astalgo, magicsys, msgs, options, - idents, lexer, passes, syntaxes, llstream, modulegraphs, - lineinfos, pathutils, tables, reports + compiler/ast/[ + ast, + astalgo, + idents, + lexer, + llstream, + lineinfos, + reports, + syntaxes, + ], + compiler/front/[ + msgs, + options + ], + compiler/sem/[ + passes, + ], + compiler/modules/[ + modulegraphs, + magicsys, + ], + std/[ + tables + ], + compiler/utils/[ + pathutils + ], + compiler/ic/[ + replayer + ] -import ic / replayer proc resetSystemArtifacts*(g: ModuleGraph) = magicsys.resetSysTypes(g) diff --git a/compiler/nimblecmd.nim b/compiler/modules/nimblecmd.nim similarity index 95% rename from compiler/nimblecmd.nim rename to compiler/modules/nimblecmd.nim index e00f4d9a38c..866c8629c57 100644 --- a/compiler/nimblecmd.nim +++ b/compiler/modules/nimblecmd.nim @@ -9,10 +9,27 @@ ## Implements some helper procs for Nimble (Nim's package manager) support. -import parseutils, strutils, os, options, msgs, sequtils, lineinfos, pathutils, - std/sha1, tables +import + std/[ + parseutils, + strutils, + os, + sha1, + tables, + sequtils + ], + compiler/front/[ + options, + msgs, + ], + compiler/ast/[ + lineinfos, + reports + ], + compiler/utils/[ + pathutils + ] -import reports proc addPath*(conf: ConfigRef; path: AbsoluteDir, info: TLineInfo) = if not conf.searchPaths.contains(path): diff --git a/compiler/nimpaths.nim b/compiler/modules/nimpaths.nim similarity index 100% rename from compiler/nimpaths.nim rename to compiler/modules/nimpaths.nim diff --git a/compiler/packagehandling.nim b/compiler/modules/packagehandling.nim similarity index 100% rename from compiler/packagehandling.nim rename to compiler/modules/packagehandling.nim diff --git a/compiler/nim.cfg b/compiler/nim.cfg index 4a0287cb5b1..a36ce12026f 100644 --- a/compiler/nim.cfg +++ b/compiler/nim.cfg @@ -30,3 +30,5 @@ define:useStdoutAsStdmsg experimental:strictEffects warningAsError:Effect:on @end + +path:"$config/.." \ No newline at end of file diff --git a/compiler/nim.nim b/compiler/nim.nim index ddc73a9196b..f4c14c01c7a 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -24,9 +24,24 @@ when defined(windows) and not defined(nimKochBootstrap): {.link: "../icons/nim-i386-windows-vcc.res".} import - cli_reporter, - commands, options, msgs, extccomp, main, idents, cmdlinehelper, - pathutils, modulegraphs, reports + compiler/backend/[ + extccomp + ], + compiler/front/[ + msgs, main, cmdlinehelper, options, commands, cli_reporter + ], + compiler/utils/[ + pathutils + ], + compiler/ast/[ + reports, idents + ] + + +# import +# cli_reporter, +# commands, options, msgs, main, idents, cmdlinehelper, +# pathutils, modulegraphs, reports from browsers import openDefaultBrowser from nodejs import findNodeJs diff --git a/compiler/nimfix/nimfix.nim b/compiler/nimfix/nimfix.nim index 30c138f793d..0913403ea23 100644 --- a/compiler/nimfix/nimfix.nim +++ b/compiler/nimfix/nimfix.nim @@ -9,12 +9,36 @@ ## Nimfix is a tool that helps to convert old-style Nimrod code to Nim code. -import strutils, os, parseopt -import compiler/[options, commands, modules, sem, - passes, passaux, linter, - msgs, nimconf, - extccomp, condsyms, - modulegraphs, idents] +import + std/[ + strutils, + os, + parseopt + ], + compiler/ast/[ + idents + ], + compiler/modules/[ + modules, + modulegraphs + ], + compiler/front/[ + options, + commands, + msgs, + condsyms, + nimconf + ], + compiler/sem/[ + sem, + passes, + passaux, + linter + ], + compiler/backend/[ + extccomp + ] + const Usage = """ Nimfix - Tool to patch Nim code diff --git a/compiler/nimfix/prettybase.nim b/compiler/nimfix/prettybase.nim index fbc2e3bd185..f656b100fc4 100644 --- a/compiler/nimfix/prettybase.nim +++ b/compiler/nimfix/prettybase.nim @@ -7,8 +7,23 @@ # distribution, for details about the copyright. # -import strutils except Letters -import ".." / [ast, msgs, lineinfos, idents, options, linter] + +import std/strutils except Letters +import + std/[ + ], + compiler/ast/[ + ast, + lineinfos, + idents, + linter + ], + compiler/front/[ + msgs, + options + ] + + proc replaceDeprecated*(conf: ConfigRef; info: TLineInfo; oldSym, newSym: PIdent) = let line = sourceLine(conf, info) diff --git a/compiler/aliases.nim b/compiler/sem/aliases.nim similarity index 100% rename from compiler/aliases.nim rename to compiler/sem/aliases.nim diff --git a/compiler/closureiters.nim b/compiler/sem/closureiters.nim similarity index 100% rename from compiler/closureiters.nim rename to compiler/sem/closureiters.nim diff --git a/compiler/concepts.nim b/compiler/sem/concepts.nim similarity index 97% rename from compiler/concepts.nim rename to compiler/sem/concepts.nim index 384d90377d0..6fee31961b8 100644 --- a/compiler/concepts.nim +++ b/compiler/sem/concepts.nim @@ -11,10 +11,28 @@ ## for details. Note this is a first implementation and only the "Concept matching" ## section has been implemented. -import ast, astalgo, semdata, lookups, lineinfos, idents, - msgs, renderer, types, intsets, reports +import + std/[ + intsets + ], + compiler/ast/[ + ast, + astalgo, + renderer, + types, + reports, + idents, + lineinfos + ], + compiler/front/[ + msgs + ], + compiler/sem/[ + lookups, + semdata + ] -from magicsys import addSonSkipIntLit +from compiler/modules/magicsys import addSonSkipIntLit const logBindings = false diff --git a/compiler/debuginfo.nim b/compiler/sem/debuginfo.nim similarity index 100% rename from compiler/debuginfo.nim rename to compiler/sem/debuginfo.nim diff --git a/compiler/dfa.nim b/compiler/sem/dfa.nim similarity index 100% rename from compiler/dfa.nim rename to compiler/sem/dfa.nim diff --git a/compiler/evaltempl.nim b/compiler/sem/evaltempl.nim similarity index 100% rename from compiler/evaltempl.nim rename to compiler/sem/evaltempl.nim diff --git a/compiler/guards.nim b/compiler/sem/guards.nim similarity index 99% rename from compiler/guards.nim rename to compiler/sem/guards.nim index 048aefc753f..cacba743c0f 100644 --- a/compiler/guards.nim +++ b/compiler/sem/guards.nim @@ -9,8 +9,32 @@ ## This module implements the 'implies' relation for guards. -import ast, astalgo, msgs, magicsys, nimsets, trees, types, renderer, idents, - saturate, modulegraphs, options, lineinfos, int128, reports +import + compiler/ast/[ + ast, + astalgo, + renderer, + idents, + nimsets, + trees, + types, + lineinfos, + reports + ], + compiler/utils/[ + saturate, + int128, + ], + compiler/modules/[ + magicsys, + modulegraphs, + ], + compiler/front/[ + msgs, + options, + ] + + const someEq = {mEqI, mEqF64, mEqEnum, mEqCh, mEqB, mEqRef, mEqProc, diff --git a/compiler/hlo.nim b/compiler/sem/hlo.nim similarity index 100% rename from compiler/hlo.nim rename to compiler/sem/hlo.nim diff --git a/compiler/index.nim b/compiler/sem/index.nim similarity index 100% rename from compiler/index.nim rename to compiler/sem/index.nim diff --git a/compiler/injectdestructors.nim b/compiler/sem/injectdestructors.nim similarity index 100% rename from compiler/injectdestructors.nim rename to compiler/sem/injectdestructors.nim diff --git a/compiler/installer.ini b/compiler/sem/installer.ini similarity index 100% rename from compiler/installer.ini rename to compiler/sem/installer.ini diff --git a/compiler/isolation_check.nim b/compiler/sem/isolation_check.nim similarity index 98% rename from compiler/isolation_check.nim rename to compiler/sem/isolation_check.nim index 777e7f6ce80..3934724f17d 100644 --- a/compiler/isolation_check.nim +++ b/compiler/sem/isolation_check.nim @@ -11,7 +11,14 @@ ## https://github.com/nim-lang/RFCs/issues/244 for more details. import - ast, types, renderer, intsets + compiler/ast/[ + ast, + types, + renderer, + ], + std/[ + intsets + ] proc canAlias(arg, ret: PType; marker: var IntSet): bool diff --git a/compiler/lambdalifting.nim b/compiler/sem/lambdalifting.nim similarity index 100% rename from compiler/lambdalifting.nim rename to compiler/sem/lambdalifting.nim diff --git a/compiler/liftdestructors.nim b/compiler/sem/liftdestructors.nim similarity index 99% rename from compiler/liftdestructors.nim rename to compiler/sem/liftdestructors.nim index 6ae3cf55a65..d7dde8a0449 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/sem/liftdestructors.nim @@ -10,11 +10,37 @@ ## This module implements lifting for type-bound operations ## (``=sink``, ``=``, ``=destroy``, ``=deepCopy``). -import modulegraphs, lineinfos, idents, ast, renderer, semdata, - sighashes, lowerings, options, types, msgs, magicsys, tables, ccgutils, - reports - -from trees import isCaseObj +import + compiler/ast/[ + lineinfos, + idents, + ast, + renderer, + types, + reports, + trees + ], + std/[ + tables + ], + compiler/modules/[ + modulegraphs, + magicsys + ], + compiler/front/[ + options, + msgs + ], + compiler/utils/[ + ], + compiler/sem/[ + semdata, + sighashes, + lowerings + ], + compiler/backend/[ + ccgutils + ] type TLiftCtx = object diff --git a/compiler/liftlocals.nim b/compiler/sem/liftlocals.nim similarity index 100% rename from compiler/liftlocals.nim rename to compiler/sem/liftlocals.nim diff --git a/compiler/lookups.nim b/compiler/sem/lookups.nim similarity index 98% rename from compiler/lookups.nim rename to compiler/sem/lookups.nim index 1356fb88ac2..8a5843fb88c 100644 --- a/compiler/lookups.nim +++ b/compiler/sem/lookups.nim @@ -8,11 +8,36 @@ # # This module implements lookup helpers. -import std/[algorithm, strutils] + import - intsets, ast, astalgo, idents, semdata, msgs, options, - renderer, nimfix/prettybase, lineinfos, modulegraphs, - errorhandling, errorreporting, reports + std/[ + algorithm, + strutils, + intsets + ], + compiler/ast/[ + ast, + astalgo, + idents, + renderer, + lineinfos, + errorhandling, + errorreporting, + reports + ], + compiler/modules/[ + modulegraphs + ], + compiler/front/[ + msgs, + options + ], + compiler/sem/[ + semdata + ], + compiler/nimfix/[ + prettybase + ] proc ensureNoMissingOrUnusedSymbols(c: PContext; scope: PScope) @@ -385,7 +410,7 @@ proc addDecl*(c: PContext, sym: PSym) {.inline.} = proc addPrelimDecl*(c: PContext, sym: PSym) = discard c.currentScope.addUniqueSym(sym) -from ic / ic import addHidden +from compiler/ic/ic import addHidden proc addInterfaceDeclAux(c: PContext, sym: PSym) = ## adds symbol to the module for either private or public access. diff --git a/compiler/lowerings.nim b/compiler/sem/lowerings.nim similarity index 98% rename from compiler/lowerings.nim rename to compiler/sem/lowerings.nim index 2ad35e44356..dd08563073b 100644 --- a/compiler/lowerings.nim +++ b/compiler/sem/lowerings.nim @@ -12,8 +12,23 @@ const genPrefix* = ":tmp" # prefix for generated names -import ast, astalgo, types, idents, magicsys, msgs, options, modulegraphs, - lineinfos, reports +import + compiler/ast/[ + ast, + astalgo, + types, + idents, + lineinfos, + reports + ], + compiler/modules/[ + modulegraphs, + magicsys + ], + compiler/front/[ + msgs, + options + ] proc newDeref*(n: PNode): PNode {.inline.} = result = newNodeIT(nkHiddenDeref, n.info, n.typ[0]) diff --git a/compiler/nilcheck.nim b/compiler/sem/nilcheck.nim similarity index 99% rename from compiler/nilcheck.nim rename to compiler/sem/nilcheck.nim index 92af849fd06..6d73ad88a39 100644 --- a/compiler/nilcheck.nim +++ b/compiler/sem/nilcheck.nim @@ -7,10 +7,39 @@ # distribution, for details about the copyright. # -import ast, renderer, intsets, tables, msgs, options, lineinfos, - strformat, idents, treetab, hashes, reports, nilcheck_enums -import sequtils, strutils, sets +import + compiler/ast/[ + ast, + renderer, + lineinfos, + idents, + reports, + treetab, + ], + std/[ + hashes, + intsets, + tables, + strformat, + sequtils, + strutils, + sets + ], + compiler/modules/[ + magicsys, + modulegraphs, + ], + compiler/front/[ + msgs, + options, + ], + compiler/utils/[ + platform, + ], + compiler/sem/[ + nilcheck_enums + ] # IMPORTANT: notes not up to date, i'll update this comment again # diff --git a/compiler/nilcheck_enums.nim b/compiler/sem/nilcheck_enums.nim similarity index 100% rename from compiler/nilcheck_enums.nim rename to compiler/sem/nilcheck_enums.nim diff --git a/compiler/optimizer.nim b/compiler/sem/optimizer.nim similarity index 100% rename from compiler/optimizer.nim rename to compiler/sem/optimizer.nim diff --git a/compiler/parampatterns.nim b/compiler/sem/parampatterns.nim similarity index 98% rename from compiler/parampatterns.nim rename to compiler/sem/parampatterns.nim index e936eca8bd5..632432f3070 100644 --- a/compiler/parampatterns.nim +++ b/compiler/sem/parampatterns.nim @@ -10,8 +10,22 @@ ## This module implements the pattern matching features for term rewriting ## macro support. -import strutils, ast, types, msgs, renderer, wordrecg, trees, - options, reports +import + std/[ + strutils + ], + compiler/ast/[ + ast, + types, + renderer, + wordrecg, + trees, + reports + ], + compiler/front/[ + msgs, + options + ] # we precompile the pattern here for efficiency into some internal # stack based VM :-) Why? Because it's fun; I did no benchmarks to see if that diff --git a/compiler/passaux.nim b/compiler/sem/passaux.nim similarity index 100% rename from compiler/passaux.nim rename to compiler/sem/passaux.nim diff --git a/compiler/passes.nim b/compiler/sem/passes.nim similarity index 96% rename from compiler/passes.nim rename to compiler/sem/passes.nim index cd749f1989f..297bd108bcb 100644 --- a/compiler/passes.nim +++ b/compiler/sem/passes.nim @@ -11,10 +11,26 @@ ## `TPass` interface. import - options, ast, llstream, msgs, - syntaxes, modulegraphs, reorder, - lineinfos, pathutils, - reports + compiler/front/[ + options, + msgs, + ], + compiler/modules/[ + modulegraphs, + ], + compiler/ast/[ + ast, + llstream, + syntaxes, + reports, + lineinfos, + ], + compiler/sem/[ + reorder, + ], + compiler/utils/[ + pathutils, + ] type TPassData* = tuple[input: PNode, closeOutput: PNode] diff --git a/compiler/patterns.nim b/compiler/sem/patterns.nim similarity index 100% rename from compiler/patterns.nim rename to compiler/sem/patterns.nim diff --git a/compiler/pragmas.nim b/compiler/sem/pragmas.nim similarity index 100% rename from compiler/pragmas.nim rename to compiler/sem/pragmas.nim diff --git a/compiler/procfind.nim b/compiler/sem/procfind.nim similarity index 100% rename from compiler/procfind.nim rename to compiler/sem/procfind.nim diff --git a/compiler/renderverbatim.nim b/compiler/sem/renderverbatim.nim similarity index 100% rename from compiler/renderverbatim.nim rename to compiler/sem/renderverbatim.nim diff --git a/compiler/reorder.nim b/compiler/sem/reorder.nim similarity index 98% rename from compiler/reorder.nim rename to compiler/sem/reorder.nim index 6a82b91ebcd..4e56b5da0f5 100644 --- a/compiler/reorder.nim +++ b/compiler/sem/reorder.nim @@ -1,8 +1,26 @@ import - intsets, ast, idents, algorithm, renderer, - msgs, modulegraphs, syntaxes, options, modulepaths, - lineinfos, reports + std/[ + intsets, + algorithm, + ], + compiler/ast/[ + ast, + idents, + renderer, + syntaxes, + lineinfos, + reports + ], + compiler/front/[ + msgs, + options, + ], + compiler/modules/[ + modulegraphs, + modulepaths, + ] + type DepN = ref object diff --git a/compiler/rodutils.nim b/compiler/sem/rodutils.nim similarity index 100% rename from compiler/rodutils.nim rename to compiler/sem/rodutils.nim diff --git a/compiler/sem.nim b/compiler/sem/sem.nim similarity index 96% rename from compiler/sem.nim rename to compiler/sem/sem.nim index bd2b0d91d1d..1da879f2f5c 100644 --- a/compiler/sem.nim +++ b/compiler/sem/sem.nim @@ -10,21 +10,84 @@ # This module implements the semantic checking pass. import - ast, strutils, options, astalgo, trees, - wordrecg, ropes, msgs, idents, renderer, types, platform, math, - magicsys, nversion, nimsets, semfold, modulepaths, importer, - procfind, lookups, pragmas, passes, semdata, semtypinst, sigmatch, - intsets, transf, vmdef, vm, aliases, cgmeth, lambdalifting, - evaltempl, patterns, parampatterns, sempass2, linter, semmacrosanity, - lowerings, plugins/active, lineinfos, strtabs, int128, - isolation_check, typeallowed, modulegraphs, enumtostr, concepts, astmsgs, - errorhandling, errorreporting, reports, debugutils + std/[ + strutils, + math, + strtabs, + intsets + ], + compiler/ast/[ + ast, + astalgo, + trees, + wordrecg, + renderer, + types, + nimsets, + errorreporting, + errorhandling, + astmsgs, + reports, + lineinfos, + idents, + enumtostr + ], + compiler/modules/[ + magicsys, + modulepaths, + importer, + modulegraphs + ], + compiler/front/[ + options, + msgs + ], + compiler/utils/[ + ropes, + platform, + nversion, + debugutils, + int128 + ], + compiler/sem/[ + semfold, + concepts, + semmacrosanity, + typeallowed, + isolation_check, + procfind, + lookups, + pragmas, + passes, + semdata, + semtypinst, + sigmatch, + transf, + aliases, + lambdalifting, + sempass2, + patterns, + parampatterns, + evaltempl, + lowerings, + linter + ], + compiler/backend/[ + cgmeth + ], + compiler/plugins/[ + active + ], + compiler/vm/[ + vmdef, + vm + ] when defined(nimfix): import nimfix/prettybase when not defined(leanCompiler): - import spawn + import compiler/sem/spawn # implementation diff --git a/compiler/semcall.nim b/compiler/sem/semcall.nim similarity index 100% rename from compiler/semcall.nim rename to compiler/sem/semcall.nim diff --git a/compiler/semdata.nim b/compiler/sem/semdata.nim similarity index 98% rename from compiler/semdata.nim rename to compiler/sem/semdata.nim index df3503de788..ee926d39810 100644 --- a/compiler/semdata.nim +++ b/compiler/sem/semdata.nim @@ -9,19 +9,41 @@ ## This module contains the data structures for the semantic checking phase. -import tables - import - intsets, options, ast, astalgo, msgs, idents, renderer, - magicsys, vmdef, modulegraphs, lineinfos, sets, pathutils, - reports + std/[ + intsets, + sets, + tables, + strutils + ], + compiler/front/[ + options, + msgs, + ], + compiler/ast/[ + ast, + astalgo, + idents, + renderer, + lineinfos, + reports + ], + compiler/modules/[ + magicsys, + modulegraphs, + ], + compiler/vm/[ + vmdef, + ], + compiler/ic/[ + ic + ], + compiler/utils/[ + pathutils, + ] export TExprFlag, TExprFlags -import std/strutils - -import ic / ic - type TOptionEntry* = object # entries to put on a stack for pragma parsing options*: TOptions diff --git a/compiler/semexprs.nim b/compiler/sem/semexprs.nim similarity index 100% rename from compiler/semexprs.nim rename to compiler/sem/semexprs.nim diff --git a/compiler/semfields.nim b/compiler/sem/semfields.nim similarity index 100% rename from compiler/semfields.nim rename to compiler/sem/semfields.nim diff --git a/compiler/semfold.nim b/compiler/sem/semfold.nim similarity index 98% rename from compiler/semfold.nim rename to compiler/sem/semfold.nim index 4c9c44b9259..5989a744494 100644 --- a/compiler/semfold.nim +++ b/compiler/sem/semfold.nim @@ -11,10 +11,35 @@ ## and evaluation phase import - strutils, options, ast, trees, nimsets, - platform, math, msgs, renderer, types, - commands, magicsys, modulegraphs, strtabs, lineinfos, - reports + compiler/ast/[ + renderer, + types, + nimsets, + ast, + trees, + lineinfos, + reports + ], + std/[ + strutils, + strtabs, + math, + ], + compiler/modules/[ + magicsys, + modulegraphs, + ], + compiler/front/[ + commands, + msgs, + options, + ], + compiler/utils/[ + platform, + ] + + + from system/memory import nimCStrLen diff --git a/compiler/semgnrc.nim b/compiler/sem/semgnrc.nim similarity index 100% rename from compiler/semgnrc.nim rename to compiler/sem/semgnrc.nim diff --git a/compiler/seminst.nim b/compiler/sem/seminst.nim similarity index 100% rename from compiler/seminst.nim rename to compiler/sem/seminst.nim diff --git a/compiler/semmacrosanity.nim b/compiler/sem/semmacrosanity.nim similarity index 96% rename from compiler/semmacrosanity.nim rename to compiler/sem/semmacrosanity.nim index d431ced0b97..f2710faf3a6 100644 --- a/compiler/semmacrosanity.nim +++ b/compiler/sem/semmacrosanity.nim @@ -9,8 +9,19 @@ ## Implements type sanity checking for ASTs resulting from macros. Lots of ## room for improvement here. - -import ast, msgs, types, options, reports, strutils +import + std/[ + strutils + ], + compiler/ast/[ + ast, + types, + reports, + ], + compiler/front/[ + msgs, + options, + ] proc ithField(n: PNode, field: var int): PSym = result = nil diff --git a/compiler/semmagic.nim b/compiler/sem/semmagic.nim similarity index 100% rename from compiler/semmagic.nim rename to compiler/sem/semmagic.nim diff --git a/compiler/semobjconstr.nim b/compiler/sem/semobjconstr.nim similarity index 100% rename from compiler/semobjconstr.nim rename to compiler/sem/semobjconstr.nim diff --git a/compiler/semparallel.nim b/compiler/sem/semparallel.nim similarity index 100% rename from compiler/semparallel.nim rename to compiler/sem/semparallel.nim diff --git a/compiler/sempass2.nim b/compiler/sem/sempass2.nim similarity index 99% rename from compiler/sempass2.nim rename to compiler/sem/sempass2.nim index 95e58511b99..4c8d7aa6c6b 100644 --- a/compiler/sempass2.nim +++ b/compiler/sem/sempass2.nim @@ -8,10 +8,43 @@ # import - intsets, ast, astalgo, msgs, renderer, magicsys, types, idents, trees, - wordrecg, strutils, options, guards, lineinfos, semfold, semdata, - modulegraphs, varpartitions, typeallowed, nilcheck, tables, errorreporting, - errorhandling, reports, debugutils + std/[ + strutils, + tables, + intsets, + ], + compiler/ast/[ + ast, + renderer, + astalgo, + types, + idents, + wordrecg, + reports, + errorreporting, + errorhandling, + lineinfos, + trees, + ], + compiler/front/[ + options, + msgs, + ], + compiler/modules/[ + modulegraphs, + magicsys, + ], + compiler/utils/[ + debugutils + ], + compiler/sem/[ + varpartitions, + typeallowed, + guards, + semfold, + semdata, + nilcheck, + ] when defined(useDfa): import dfa diff --git a/compiler/semstmts.nim b/compiler/sem/semstmts.nim similarity index 100% rename from compiler/semstmts.nim rename to compiler/sem/semstmts.nim diff --git a/compiler/semtempl.nim b/compiler/sem/semtempl.nim similarity index 100% rename from compiler/semtempl.nim rename to compiler/sem/semtempl.nim diff --git a/compiler/semtypes.nim b/compiler/sem/semtypes.nim similarity index 100% rename from compiler/semtypes.nim rename to compiler/sem/semtypes.nim diff --git a/compiler/semtypinst.nim b/compiler/sem/semtypinst.nim similarity index 98% rename from compiler/semtypinst.nim rename to compiler/sem/semtypinst.nim index fb519b66034..26c8aadb645 100644 --- a/compiler/semtypinst.nim +++ b/compiler/sem/semtypinst.nim @@ -9,8 +9,29 @@ # This module does the instantiation of generic types. -import ast, astalgo, msgs, types, magicsys, semdata, renderer, options, - lineinfos, modulegraphs, reports, strutils +import + std/[ + strutils + ], + compiler/ast/[ + ast, + astalgo, + types, + renderer, + lineinfos, + reports, + ], + compiler/modules/[ + magicsys, + modulegraphs, + ], + compiler/front/[ + msgs, + options, + ], + compiler/sem/[ + semdata, + ] from concepts import makeTypeDesc diff --git a/compiler/sighashes.nim b/compiler/sem/sighashes.nim similarity index 98% rename from compiler/sighashes.nim rename to compiler/sem/sighashes.nim index d02728627ca..0f7081b965a 100644 --- a/compiler/sighashes.nim +++ b/compiler/sem/sighashes.nim @@ -8,10 +8,22 @@ # ## Computes hash values for routine (proc, method etc) signatures. - -import ast, tables, ropes, md5, modulegraphs -from hashes import Hash -import types +import + std/[ + tables, + md5, + hashes + ], + compiler/ast/[ + ast, + types + ], + compiler/modules/[ + modulegraphs + ], + compiler/utils/[ + ropes + ] proc `&=`(c: var MD5Context, s: string) = md5Update(c, s, s.len) proc `&=`(c: var MD5Context, ch: char) = diff --git a/compiler/sigmatch.nim b/compiler/sem/sigmatch.nim similarity index 99% rename from compiler/sigmatch.nim rename to compiler/sem/sigmatch.nim index 3e48cff701f..1a04ec5d603 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sem/sigmatch.nim @@ -9,12 +9,44 @@ ## This module implements the signature matching for resolving ## the call to overloaded procs, generic procs and operators. - import - intsets, ast, astalgo, semdata, types, msgs, renderer, lookups, semtypinst, - magicsys, idents, lexer, options, parampatterns, strutils, trees, - linter, lineinfos, lowerings, modulegraphs, concepts, errorhandling, - reports, debugutils + std/[ + intsets, + strutils, + ], + compiler/ast/[ + ast, + astalgo, + types, + renderer, + idents, + lexer, + trees, + linter, + lineinfos, + errorhandling, + reports, + ], + compiler/modules/[ + modulegraphs, + magicsys, + ], + compiler/front/[ + msgs, + options, + ], + compiler/utils/[ + debugutils + ], + compiler/sem/[ + semdata, + semtypinst, + lookups, + lowerings, + parampatterns, + concepts, + ] + type MismatchInfo* = object @@ -1623,7 +1655,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, elif a.len > 0 and a.lastSon == f: # Needed for checking `Y` == `Addable` in the following #[ - type + type Addable = concept a, type A a + a is A MyType[T: Addable; Y: static T] = object @@ -1742,7 +1774,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, elif f.base.kind == tyGenericParam: # Handling things like `type A[T; Y: static T] = object`, the reason this is here is the following: # The information is lost in the future steps so eventually it gets `T` vs. `T` which can be solved with a change to the tyTypedesc branch, - # but it then gets typedesc[int] vs. int literal (2) without knowing either side is static. + # but it then gets typedesc[int] vs. int literal (2) without knowing either side is static. # Seems the only place to solve it is here anywhere lower just lacks the knowledge to know to check the children types. if f.base.len > 0: # There is a constraint, handle it result = typeRel(c, f.base.lastSon, a, flags) @@ -2686,7 +2718,7 @@ proc instTypeBoundOp*(c: PContext; dc: PSym; t: PType; info: TLineInfo; if op == attachedDeepCopy: assert sfFromGeneric in result.flags -include suggest +include compiler/tools/suggest when not declared(tests): template tests(s: untyped) = discard diff --git a/compiler/sinkparameter_inference.nim b/compiler/sem/sinkparameter_inference.nim similarity index 100% rename from compiler/sinkparameter_inference.nim rename to compiler/sem/sinkparameter_inference.nim diff --git a/compiler/sizealignoffsetimpl.nim b/compiler/sem/sizealignoffsetimpl.nim similarity index 100% rename from compiler/sizealignoffsetimpl.nim rename to compiler/sem/sizealignoffsetimpl.nim diff --git a/compiler/sourcemap.nim b/compiler/sem/sourcemap.nim similarity index 100% rename from compiler/sourcemap.nim rename to compiler/sem/sourcemap.nim diff --git a/compiler/spawn.nim b/compiler/sem/spawn.nim similarity index 100% rename from compiler/spawn.nim rename to compiler/sem/spawn.nim diff --git a/compiler/transf.nim b/compiler/sem/transf.nim similarity index 100% rename from compiler/transf.nim rename to compiler/sem/transf.nim diff --git a/compiler/typeallowed.nim b/compiler/sem/typeallowed.nim similarity index 98% rename from compiler/typeallowed.nim rename to compiler/sem/typeallowed.nim index 138b4f27ee6..6116152fe54 100644 --- a/compiler/typeallowed.nim +++ b/compiler/sem/typeallowed.nim @@ -11,7 +11,20 @@ ## for invalid types like 'openArray[var int]'. import - intsets, ast, renderer, options, semdata, types + std/[ + intsets, + ], + compiler/ast/[ + ast, + renderer, + types + ], + compiler/front/[ + options, + ], + compiler/sem/[ + semdata, + ] export TTypeAllowedFlag, TTypeAllowedFlags diff --git a/compiler/varpartitions.nim b/compiler/sem/varpartitions.nim similarity index 99% rename from compiler/varpartitions.nim rename to compiler/sem/varpartitions.nim index 0da3ea288b8..2fc459a3196 100644 --- a/compiler/varpartitions.nim +++ b/compiler/sem/varpartitions.nim @@ -28,9 +28,26 @@ ## See https://nim-lang.github.io/Nim/manual_experimental.html#view-types-algorithm ## for a high-level description of how borrow checking works. -import ast, types, lineinfos, options, msgs, renderer, typeallowed, modulegraphs, - reports -from trees import getMagic, isNoSideEffectPragma, stupidStmtListExpr +import + compiler/ast/[ + ast, + lineinfos, + types, + renderer, + reports + ], + compiler/front/[ + options, + msgs, + ], + compiler/sem/[ + typeallowed, + ], + compiler/modules/[ + modulegraphs, + ] + +from compiler/ast/trees import getMagic, isNoSideEffectPragma, stupidStmtListExpr from isolation_check import canAlias type diff --git a/compiler/docgen.nim b/compiler/tools/docgen.nim similarity index 100% rename from compiler/docgen.nim rename to compiler/tools/docgen.nim diff --git a/compiler/docgen2.nim b/compiler/tools/docgen2.nim similarity index 100% rename from compiler/docgen2.nim rename to compiler/tools/docgen2.nim diff --git a/compiler/suggest.nim b/compiler/tools/suggest.nim similarity index 99% rename from compiler/suggest.nim rename to compiler/tools/suggest.nim index 5cf8113e169..17734511f22 100644 --- a/compiler/suggest.nim +++ b/compiler/tools/suggest.nim @@ -32,8 +32,21 @@ # included from sigmatch.nim -import algorithm, sets, prefixmatches, parseutils, tables -from wordrecg import wDeprecated, wError, wAddr, wYield +import + std/[ + algorithm, + parseutils, + sets, + tables + ], + compiler/ast/[ + wordrecg + ], + compiler/utils/[ + prefixmatches + ] + + when defined(nimsuggest): import passes, tables, pathutils # importer diff --git a/compiler/bitsets.nim b/compiler/utils/bitsets.nim similarity index 100% rename from compiler/bitsets.nim rename to compiler/utils/bitsets.nim diff --git a/compiler/btrees.nim b/compiler/utils/btrees.nim similarity index 100% rename from compiler/btrees.nim rename to compiler/utils/btrees.nim diff --git a/compiler/debugutils.nim b/compiler/utils/debugutils.nim similarity index 99% rename from compiler/debugutils.nim rename to compiler/utils/debugutils.nim index ea56b9bb38a..9512d1806f7 100644 --- a/compiler/debugutils.nim +++ b/compiler/utils/debugutils.nim @@ -12,7 +12,14 @@ useful debugging flags: ]# -import options, reports, msgs +import + compiler/front/[ + options, + msgs + ], + compiler/ast/[ + reports, + ] proc isCompilerDebug*(conf: ConfigRef): bool {.inline.} = ##[ diff --git a/compiler/int128.nim b/compiler/utils/int128.nim similarity index 100% rename from compiler/int128.nim rename to compiler/utils/int128.nim diff --git a/compiler/nodejs.nim b/compiler/utils/nodejs.nim similarity index 100% rename from compiler/nodejs.nim rename to compiler/utils/nodejs.nim diff --git a/compiler/nversion.nim b/compiler/utils/nversion.nim similarity index 100% rename from compiler/nversion.nim rename to compiler/utils/nversion.nim diff --git a/compiler/pathutils.nim b/compiler/utils/pathutils.nim similarity index 100% rename from compiler/pathutils.nim rename to compiler/utils/pathutils.nim diff --git a/compiler/platform.nim b/compiler/utils/platform.nim similarity index 100% rename from compiler/platform.nim rename to compiler/utils/platform.nim diff --git a/compiler/pluginsupport.nim b/compiler/utils/pluginsupport.nim similarity index 100% rename from compiler/pluginsupport.nim rename to compiler/utils/pluginsupport.nim diff --git a/compiler/prefixmatches.nim b/compiler/utils/prefixmatches.nim similarity index 100% rename from compiler/prefixmatches.nim rename to compiler/utils/prefixmatches.nim diff --git a/compiler/ropes.nim b/compiler/utils/ropes.nim similarity index 100% rename from compiler/ropes.nim rename to compiler/utils/ropes.nim diff --git a/compiler/saturate.nim b/compiler/utils/saturate.nim similarity index 100% rename from compiler/saturate.nim rename to compiler/utils/saturate.nim diff --git a/compiler/strutils2.nim b/compiler/utils/strutils2.nim similarity index 100% rename from compiler/strutils2.nim rename to compiler/utils/strutils2.nim diff --git a/compiler/evalffi.nim b/compiler/vm/evalffi.nim similarity index 100% rename from compiler/evalffi.nim rename to compiler/vm/evalffi.nim diff --git a/compiler/gorgeimpl.nim b/compiler/vm/gorgeimpl.nim similarity index 100% rename from compiler/gorgeimpl.nim rename to compiler/vm/gorgeimpl.nim diff --git a/compiler/macrocacheimpl.nim b/compiler/vm/macrocacheimpl.nim similarity index 100% rename from compiler/macrocacheimpl.nim rename to compiler/vm/macrocacheimpl.nim diff --git a/compiler/nimeval.nim b/compiler/vm/nimeval.nim similarity index 100% rename from compiler/nimeval.nim rename to compiler/vm/nimeval.nim diff --git a/compiler/vm.nim b/compiler/vm/vm.nim similarity index 100% rename from compiler/vm.nim rename to compiler/vm/vm.nim diff --git a/compiler/vm_enums.nim b/compiler/vm/vm_enums.nim similarity index 100% rename from compiler/vm_enums.nim rename to compiler/vm/vm_enums.nim diff --git a/compiler/vmconv.nim b/compiler/vm/vmconv.nim similarity index 100% rename from compiler/vmconv.nim rename to compiler/vm/vmconv.nim diff --git a/compiler/vmdef.nim b/compiler/vm/vmdef.nim similarity index 97% rename from compiler/vmdef.nim rename to compiler/vm/vmdef.nim index 1f1615cf7db..57a325c248c 100644 --- a/compiler/vmdef.nim +++ b/compiler/vm/vmdef.nim @@ -12,8 +12,22 @@ import tables -import ast, idents, options, modulegraphs, - lineinfos, reports, debugutils +import + compiler/ast/[ + ast, + idents, + lineinfos, + reports, + ], + compiler/modules/[ + modulegraphs, + ], + compiler/front/[ + options, + ], + compiler/utils/[ + debugutils + ] import vm_enums export vm_enums diff --git a/compiler/vmdeps.nim b/compiler/vm/vmdeps.nim similarity index 100% rename from compiler/vmdeps.nim rename to compiler/vm/vmdeps.nim diff --git a/compiler/vmgen.nim b/compiler/vm/vmgen.nim similarity index 100% rename from compiler/vmgen.nim rename to compiler/vm/vmgen.nim diff --git a/compiler/vmhooks.nim b/compiler/vm/vmhooks.nim similarity index 100% rename from compiler/vmhooks.nim rename to compiler/vm/vmhooks.nim diff --git a/compiler/vmops.nim b/compiler/vm/vmops.nim similarity index 100% rename from compiler/vmops.nim rename to compiler/vm/vmops.nim diff --git a/compiler/vmprofiler.nim b/compiler/vm/vmprofiler.nim similarity index 100% rename from compiler/vmprofiler.nim rename to compiler/vm/vmprofiler.nim