summary refs log tree commit diff stats
path: root/compiler/main.nim
Commit message (Collapse)AuthorAgeFilesLines
* remove nir; succeeded by nif (#23809)ringabout2024-07-091-35/+4
| | | ref https://github.com/nim-lang/nif
* fixes addr/hiddenAddr in strictdefs (#23477)ringabout2024-04-101-1/+1
|
* compute checksum of nim files early in the pipelines (#23268)ringabout2024-01-311-1/+1
| | | | related https://github.com/nim-lang/Nim/issues/21717 configs will be resolved later
* Show error when trying to run in folder that doesn't exist instead of ↵Jake Leahy2024-01-231-1/+2
| | | | | | | assertion (#23242) Closes #23240 Fixes regression caused by #23017
* lexer cleanups (#23037)Jacek Sieka2023-12-061-1/+0
| | | | * remove some dead code and leftovers from past features * fix yaml printing of uint64 literals
* IC: progress and refactorings (#22961)Andreas Rumpf2023-11-201-3/+9
|
* so close... (#22885)Andreas Rumpf2023-10-311-1/+3
|
* NIR: store sizes, alignments and offsets in the type graph; beginning… ↵Andreas Rumpf2023-10-161-0/+26
| | | | | (#22822) …s of a patent-pending new VM
* NIR: Nim intermediate representation (#22777)Andreas Rumpf2023-10-111-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Theoretical Benefits / Plans: - Typed assembler-like language. - Allows for a CPS transformation. - Can replace the existing C backend by a new C backend. - Can replace the VM. - Can do more effective "not nil" checking and static array bounds checking. - Can be used instead of the DFA. - Easily translatable to LLVM. - Reasonably easy to produce native code from. - Tiny memory consumption. No pointers, no cry. **In very early stages of development.** Todo: - [x] Map Nim types to IR types. - [ ] Map Nim AST to IR instructions: - [x] Map bitsets to bitops. - [ ] Implement string cases. - [ ] Implement range and index checks. - [x] Implement `default(T)` builtin. - [x] Implement multi string concat. - [ ] Write some analysis passes. - [ ] Write a backend. - [x] Integrate into the compilation pipeline.
* replaces `doAssert false` with `raiseAssert` for unreachable branches, which ↵ringabout2023-08-101-3/+3
| | | | | works better with strictdefs (#22436) replaces `doAssert false` with `raiseAssert`, which works better with strictdefs
* use strictdefs for compiler (#22365)ringabout2023-08-061-2/+2
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* Remove Deprecated Nimfix (#22062)Juan Carlos2023-06-101-1/+1
| | | | * Remove Deprecated Nimfix * Trailing whitespace cleanups
* fixes #19863; move sha1, md5 to nimble packages for 2.0 (#21702)ringabout2023-05-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * move sha1, md5 to nimble packages * boot the compiler * fixes tests * build the documentation * fixes docs * lol, I forgot koch.nim * add `nimHasChecksums` define * clone checksums but maybe copying is better * bump nimble hash * use ChecksumsStableCommit * fixes tests * deprecate them * fixes paths * fixes koch
* a better message if graphviz's dot/nodejs is not found in PATH (#21488)ghost2023-03-081-0/+7
| | | | | | | | | * finish issue #21474: a better message if dot is not found locally when using gendepend * fix a typo in compiler * trim empty path reported in `findNodeJs` * compiler/main.nim: switch raise to simply quit
* replaces implicit passes array registed at runtime with explicit function ↵ringabout2023-03-031-38/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | calls; simplify compilation pipeline (#21444) * abolish using passes in the compiler; simplify compilation pipeline * duplicate code * Really cool to have the same signature... * haul * unify other backends * refactor process * introduce PipelinePhase * refactor compiler * fixes passes * fixes nimsuggest * add a sentinel * enable docs checkj * activate doc testing * clean up * complete cleanups
* Add `--genCDeps` for better integration with CMake (#20950)Jaremy Creechley2022-11-291-0/+22
| | | | | | | | | | | | | | | | | * add gencdeps option * add case statement * Update compiler/main.nim * Update compiler/main.nim * Apply suggestions from code review Fixes Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-1/+0
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* fixes #9462; jsondoc --index can generate a theindex.json (#20205)ringabout2022-09-061-1/+5
|
* Improve Markdown code blocks & start moving docs to Markdown style (#19954)Andrey Makarov2022-07-151-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add additional parameters parsing (other implementations will just ignore them). E.g. if in RST we have: .. code:: nim :test: "nim c $1" ... then in Markdown that will be: ```nim test="nim c $1" ... ``` - implement Markdown interpretation of additional indentation which is less than 4 spaces (>=4 spaces is a code block but it's not implemented yet). RST interpretes it as quoted block, for Markdown it's just normal paragraphs. - add separate `md2html` and `md2tex` commands. This is to separate Markdown behavior in cases when it diverges w.r.t. RST significantly — most conspicously like in the case of additional indentation above, and also currently the contradicting inline rule of Markdown is also turned on only in `md2html` and `md2tex`. **Rationale:** mixing Markdown and RST arbitrarily is a way to nowhere, we need to provide a way to fix the particular behavior. Note that still all commands have **both** Markdown and RST features **enabled**. In this PR `*.nim` files can be processed only in Markdown mode, while `md2html` is for `*.md` files and `rst2html` for `*.rst` files. - rename `*.rst` files to `.*md` as our current default behavior is already Markdown-ish - convert code blocks in `docgen.rst` to Markdown style as an example. Other code blocks will be converted in the follow-up PRs - fix indentation inside Markdown code blocks — additional indentation is preserved there - allow more than 3 backticks open/close blocks (tildas \~ are still not allowed to avoid conflict with RST adornment headings) see also https://github.com/nim-lang/RFCs/issues/355 - better error messages - (other) fix a bug that admonitions cannot be used in sandbox mode; fix annoying warning on line 2711
* fix #17286 nim check -b:js works (#19704)flywind2022-04-091-0/+2
| | | | | * fix #17286 nim check -b:js works * fix
* fix nim check nimscript [backport: 1.6] (#19444)flywind2022-03-231-1/+5
| | | | fix #19440; fix #3858
* move assertions out of system (#19599)flywind2022-03-231-0/+4
|
* rst: add missing line/column info for some warnings (#18383)Andrey Makarov2021-07-201-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rst: add missing line/column info for some warnings * add workaround * use TLineInfo/FileIndex for storing file names * fix blank lines in include file (rm harmful strip) * don't use ref TLineInfo * return `hasToc` as output parameter for uniformity * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rst.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * address review - stylistic things * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * unify RST warnings/errors names * doAssert + minor name change * fix a bug caught by doAssert * apply strbasics.strip to final HTML/Latex * rm redundant filename * fix test after rebase * delete `order` from rnFootnoteRef, also display errors/warnings properly when footnote references are from different files * Update compiler/lineinfos.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rstast.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rstast.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rstast.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * revert because of error: Error: cannot prove that it's safe to initialize 'info' with the runtime value for the discriminator 'kind' * Update lib/packages/docutils/rstgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * apply suggestion * Update lib/packages/docutils/rst.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * add Table for string->file name mapping * do not import compiler/lineinfos * fix ambiguous calls Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: narimiran <narimiran@disroot.org>
* docgen: move to shared RST state (fix #16990) (#18256)Andrey Makarov2021-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * docgen: move to shared RST state (fix #16990) * Update lib/packages/docutils/rst.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update lib/packages/docutils/rst.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update lib/packages/docutils/rst.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rst.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * rename `cmdDoc2` to `cmdDoc` * fix (P)RstSharedState convention * new style of initialization * misc suggestions * 1 more rename * fix a regression Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* merge BuildMode into SuccessX, remove code duplication w drnim, add useful ↵Timothee Cour2021-06-141-34/+6
| | | | | | | | | | | info to successx, add gc to compilesettings (#18252) * merge BuildMode into SuccessX, add more info * refactor duplicated with drnim * fixup * address comment
* config system: special case -d:release and -d:danger [backport:1.4] (#18051)Andreas Rumpf2021-05-201-1/+2
|
* `doc2tex`: generate docs to Latex (#17997)Andrey Makarov2021-05-141-9/+16
| | | | | * `doc2tex`: generate docs to Latex * address some comments
* fix #17853 (ascii message separator broke json nim dump) (#17887)Timothee Cour2021-04-291-1/+2
|
* Implement https://forum.nim-lang.org/t/7848#50018 (#17874)c-blake2021-04-291-4/+4
| | | | | | | | | | | | | | | | | | | | * Implement https://forum.nim-lang.org/t/7848#50018 with just the same `SuccessX` hint category, build mode on a separate, final line, and no change to how the mode is spelled for -d:release/-d:danger. * Change to add a new BuildMode hint category and keep testament in sync as per comment. * Add "--hint:buildmode:off" to `defaultHintsOff`. * Remove as requested. * As requested for tests clean up. * Address code review. * Address code review. * Mirror db456423116a9b19666f551f4d38aded3964c2e2
* `--usenimcache` (implied by `nim r main`) now caches some compile options to ↵Timothee Cour2021-04-251-17/+34
| | | | | | | | | | | avoid recompiling when project was previously compiled with such options. (#17829) * `--usenimcache` (implied by `nim r main`) now caches some compile options to avoid recompiling when project was previously compiled with such options. * works * add test * changelog * use std/with
* `--filenames:abs|canonical|legacyRelProj` for filenames in compiler msgs ↵Timothee Cour2021-04-211-3/+5
| | | | | | | (replaces `--listfullpaths:on|off`) (#17746) * use canonicalImport for filename_magicSauce * --filenames:abs|canonical|magic * rename: magic => legacyRelProj
* unit separator (#17730)Andreas Rumpf2021-04-201-2/+2
| | | | | * use the ASCII Unit Separator so that error messages can be handled precisely by the tooling * updated testament
* -d:nimDebug: calls doAssert false instead of quit (#17739)Timothee Cour2021-04-171-3/+3
|
* IC: first steps towards 'nim check --def --ic:on' (#17714)Andreas Rumpf2021-04-141-3/+12
| | | | | | | | | * IC: first steps towards 'nim check --def --ic:on' * IC navigator: deduplicate output lines * IC navigator: progress * IC navigator: use a different nimcache entry * IC navigator: special logic for templates/macros * IC navigator: proper error messages * IC navigator: prepare for testing code; document only what currently works somewhat
* IC: integrity checking (#17695)Andreas Rumpf2021-04-111-1/+3
| | | | | | * IC: integrity checking: the plumbing code * progress * progress + bugfix (yes, the code already found a bug) * implemented integrity checking
* fix #17190 `nimscript` now accepts arbitrary file extensions for `nim e ↵flywind2021-04-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | main.customext` (#17596) * fix #17190 * cah * merge * Update tnimscriptwithnimext.nim * Update tnimscriptwithmacro.nims * Apply suggestions from code review * Delete tnimscriptwithnimext.nim * Update tests/tools/tnimscriptwithmacro.nims * fix * fix * add a test * Apply suggestions from code review Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Apply suggestions from code review * Update changelog.md Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* IC: green tests (#17311)Andreas Rumpf2021-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * IC: renamed to_packed_ast module to ic module * IC: don't store the --forceBuild flag, makes it easier to test * IC: enable hello world test * Codegen: refactorings for IC; changed the name mangling algorithm * fixed the HCR regressions * life is too short for HCR * tconvexhull is now allowed to use deepCopy * IC exposed a stdlib bug, required a refactoring * codegen: code cleanups * IC: even if a module is outdated, its dependencies might come from disk * IC: progress * IC: better name mangling, module IDs are not stable * IC: another refactoring helping with --ic:on --gc:arc * disable arraymancer on Windows for the time being * disable arraymancer altogether * IC: make basic test work with 'nim cpp' * IC: progress on --ic:on --gc:arc * wip; name mangling for type info
* stricter checks for RST headlines (#17089)Andrey Makarov2021-02-201-0/+8
|
* IC: next steps (#16729)Andreas Rumpf2021-01-231-9/+17
| | | | | | | | | | | * IC: dead code elimination pass * preparations for a different codegen strategy * added documentation to the newly written code * IC: backend code * IC: backend adjustments * optimized the compiler a bit * IC: yet another massive refactoring * fixes regressions * cleanups
* IC: next steps (#16632)Andreas Rumpf2021-01-121-3/+9
| | | | | | | | | | | | | * removed dead code * beginnings of a rodfile reader * IC: record global VM state changes and pragma state changes * IC: replay pragmas and VM state changes * implemented rod load file simuation for easier, extensive testing * critical bugfix * IC: stress test logic; should also help with recursive module dependencies; WIP * IC: loading from .rod files begins to work reliably * removed ugly hacks * yet another silly mistake
* compiler: minor refactoring (#16633)Andreas Rumpf2021-01-081-12/+11
|
* make --gc:arc --exceptions:quirky work again [backport:1.4] (#16583)Andreas Rumpf2021-01-041-2/+0
| | | | | * make --gc:arc --exceptions:quirky work again [backport:1.4] * fixes #16404 [backport:1.4]
* big steps torwards an efficient, simple IC implementation (#16543)Andreas Rumpf2021-01-021-3/+2
| | | | | | | | | | | | | | | | | | | * reworked ID handling * the packed AST now has its own ID mechanism * basic serialization code works * extract rodfiles to its own module * rodfiles: store and compare configs * rodfiles: store dependencies * store config at the end * precise dependency tracking * dependency tracking for rodfiles * completed loading of PSym, PType, etc * removed dead code * bugfix: do not realloc seqs when taking addr into an element * make IC opt-in for now * makes tcompilerapi green again * final cleanups Co-authored-by: Andy Davidoff <github@andy.disruptek.com>
* fix `hintProcessing` dots interference with `static:echo` and `hintCC`; add ↵Timothee Cour2020-12-301-1/+1
| | | | | | | | | | tests for `nim secret`, add tests for hintProcessing, misc other bug fixes (#16495) * fix dots interfering with static:echo * add tests * fix hintProcessing dots for hintCC * improve trunner tests * fix bug: readLineFromStdin now writes prompt to stdout, consistent with linenoise and rdstdin * disable a failing test for windows
* fix `nim secret` dots interfering with prompt (#16491)Timothee Cour2020-12-281-1/+2
| | | | | * fix nim secret dots * cleanups
* refactorings to prepare the compiler for IC (#15935)Andreas Rumpf2020-12-171-3/+3
| | | | | | | | | | | | | | * added ic specific Nim code; WIP * make the symbol import mechanism lazy; WIP * ensure that modules can be imported multiple times * ambiguity checking * handle converters and TR macros properly * make 'enum' test category green again * special logic for semi-pure enums * makes nimsuggest tests green again * fixes nimdata * makes nimpy green again * makes more important packages work
* cmdline: improve command processing (#16056)Timothee Cour2020-11-261-66/+33
|
* Correct all eggs (#15906)Miran2020-11-101-1/+1
| | | | * "eg" is a misspelled "egg", "e.g." is "exempli gratia" * Also, "ie" is "i.e.".
* new: `nim -e:cmd` to run a command directly; also fixes #15731 (#15687)Timothee Cour2020-11-091-2/+3
| | | | | | | | | | | | | | | * new: `nim -i cmd` * rename -i to -e (for eval); consistent with majority of other programing languages * `nim e -e:cmd` now works; bugfix: `echo cmd | nim e -` now works * honor --betterRun * address comments * --eval alias for -e (replaces undocumented --eval which was a noop) * --eval now defaults to e (nimscript) instead of r * address comment: remove -e, only keep --eval * address comment * fixup * Update compiler/nimconf.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Use modern enums in compiler (#15775)cooldome2020-11-021-2/+2
|