Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
35c1eae
implement the language definition DSL
zerbina May 30, 2025
8602a88
start with writing some language definitions
zerbina May 30, 2025
b621ac1
nanopass: disallow duplicate element names
zerbina Jun 3, 2025
b680982
passes: fix duplicate elements names
zerbina Jun 3, 2025
2734eda
Merge branch 'main' into nanopass
zerbina Jun 3, 2025
3019584
nanopass: split type sections
zerbina Jun 3, 2025
7a3fc69
nanopass: don't consider metavar names for form equality
zerbina Jul 5, 2025
7cd20dd
nanopass: properly implement node-tags
zerbina Jul 5, 2025
692afc0
passes: implement a full set of ILs/passes
zerbina Jul 5, 2025
3fb326c
Merge branch 'main' into nanopass
zerbina Aug 18, 2025
da88059
nanopass: implement a subset of the major macros
zerbina Aug 18, 2025
1f0e97d
passes: fix a few issues
zerbina Aug 18, 2025
c25b249
passes: remove the deprecated `genSym` usage
zerbina Aug 18, 2025
05b0a5c
nanopass: split the module into multiple modules
zerbina Oct 10, 2025
14a2d4c
nppass: fix generated transformers having the wrong type
zerbina Oct 10, 2025
b3ca101
nptransform: improve `transform`
zerbina Oct 10, 2025
af8e83c
nanopass: move `ntags` to `nplang`
zerbina Dec 1, 2025
0baeb02
nanopass: implement the first revision of terminals support
zerbina Dec 1, 2025
5de07be
nanopass: use a different approach to terminal storage
zerbina Dec 1, 2025
c08e026
passes: provide the `Literals` storage type
zerbina Dec 1, 2025
f7f53e2
nanopass: add an S-expression renderer generator
zerbina Dec 1, 2025
e3f0f94
passes: add a test for the S-expression renderer generator
zerbina Dec 1, 2025
39f5a8d
Merge branch 'main' into nanopass
zerbina Dec 1, 2025
dc77b61
docs: add the rough skeleton of a manual
zerbina Dec 13, 2025
f68c41b
koch: implement a simple doc building command
zerbina Dec 13, 2025
d391e77
ci: integrate doc testing/building
zerbina Dec 13, 2025
2a89f6f
nanopass: make terminal definition syntax more regular
zerbina Dec 20, 2025
47ca6b5
passes: adjust to the new syntax for terminals
zerbina Dec 20, 2025
ead76ff
manual: adjust to the new syntax for terminals
zerbina Dec 20, 2025
bcf9e1d
literals: remove `Ident` handling
zerbina Jan 7, 2026
390d643
nptransform: move form rendering to `nplang`
zerbina Jan 7, 2026
717337f
asts, nppass: fix some symbol binding issues
zerbina Jan 7, 2026
20eb1a1
asts: fix `items` iterator not compiling
zerbina Jan 7, 2026
7ebfe9c
asts: allow arbitrary integers for `ChildSlice` indexing
zerbina Jan 7, 2026
4b8336f
asts: add `len` query
zerbina Jan 7, 2026
690fdc0
asts: remove obsolete `Storage` type
zerbina Jan 7, 2026
b05581f
literals: implement small-value optimization
zerbina Jan 7, 2026
b7e4204
nppass: make `outpass` work again
zerbina Jan 7, 2026
246477e
nanopass: close over `Ast` instead of just the tree
zerbina Jan 7, 2026
c4ccb71
nanopass: minor cleanup
zerbina Jan 7, 2026
83ce3e1
nanopass: move `isAtom` and `RefTag` to `asts`
zerbina Jan 7, 2026
14a6a0d
npmatch: rework the pattern matching feature
zerbina Jan 7, 2026
394edbb
npbuild: rework form construction feature
zerbina Jan 7, 2026
d4ce93b
nanopass: use abstract cursors for tree traversal
zerbina Jan 7, 2026
136e9bf
nanopass: rework type transformers
zerbina Jan 7, 2026
04f911c
nanopass: rework pass signatures
zerbina Jan 7, 2026
6cfc336
asts: make cursor logic swappable for `ChildSlice`
zerbina Jan 7, 2026
dd1ba8d
asts: implement `IndCursor`
zerbina Jan 7, 2026
9bd6aa2
nanopass: implement output introspection
zerbina Jan 7, 2026
807b3e3
asts: store pointer to tree in `ChildSlice`
zerbina Jan 7, 2026
78cd6e6
asts, nppass: implement structural equality comparison
zerbina Jan 7, 2026
0b55735
npparser: implement an AST parser generator
zerbina Jan 7, 2026
c95c7fd
npsexpr: rework & use the "unparser" terminology
zerbina Jan 7, 2026
0950a37
passes: move `defineCompiler` to dedicated module
zerbina Jan 7, 2026
8dc5e92
implement the legacy passes using the framework
zerbina Jan 7, 2026
314a42c
nanopass: remove the `parser` and `unparser` macros
zerbina Jan 13, 2026
fd5652f
nanopass: move default processor definition into template
zerbina Jan 13, 2026
99cb3f0
nptransform: support more general transformers
zerbina Jan 13, 2026
96fc0cb
nppass: adjust the built-in transformers
zerbina Jan 13, 2026
5c829d3
nppass: support declaring all transformer types with `.transform`
zerbina Jan 13, 2026
59e0e8d
nppass: add the `.manual` pragma
zerbina Jan 13, 2026
5f12a02
npbuild: require full AST as input for `build`
zerbina Jan 13, 2026
992eea2
nanopass: add the "nanopass record" feature
zerbina Jan 13, 2026
2c59dd2
asts: use type aliases for tree and nodes
zerbina Jan 13, 2026
13629bd
asts: abstract over the internal node layout
zerbina Jan 13, 2026
7b3631e
npmatch: update leftover `kind` field usage
zerbina Jan 20, 2026
32fc212
nanopass: fix `match` pattern matching
zerbina Jan 20, 2026
0501df7
nppass: fix generated record transformers
zerbina Jan 20, 2026
f58c146
nanopass: implement source location attributes
zerbina Jan 20, 2026
1c1d095
literals: implement `SourceLoc` storage
zerbina Jan 20, 2026
da74df4
asts: rename `Metavar` to `Production`
zerbina Jan 20, 2026
dfd4746
asts: renamed `Value` field `index` to `id`
zerbina Jan 20, 2026
3b3fa6c
nanopass: move `resolve` to a separate module
zerbina Jan 20, 2026
11771de
npbuild: don't use `copyLineInfoForTree`
zerbina Jan 20, 2026
f51902d
nplang: rename `tag` field of `Form` to `name`
zerbina Jan 20, 2026
2baeeed
nplanggen: move `entry` field to the top
zerbina Jan 20, 2026
8480943
nplangdef: remove tag tracking from `LangDef`
zerbina Jan 20, 2026
e43025e
nplangdef: implement proper duplicate production detection
zerbina Jan 20, 2026
a16c5c2
nplanggen: fix errors pointing to the wrong location
zerbina Jan 20, 2026
f8f876b
nplangdef: implement entry point configuration
zerbina Jan 20, 2026
e84445a
nplangdef: disallow changing the meaning of type productions
zerbina Jan 20, 2026
69bc160
nplanggen: reject problematic non-terminal compositions
zerbina Jan 20, 2026
85448f6
nppass: use template for definition of injected routines
zerbina Jan 20, 2026
70fa154
helper: remove `copyLineInfoForTree`
zerbina Jan 20, 2026
455b118
npbuild, nppass: fix line info for `.error` pragmas
zerbina Jan 20, 2026
efd7ab1
nanopass: clean up & polish
zerbina Jan 20, 2026
a60182b
compilerdef: adjust to nanopass changes
zerbina Jan 20, 2026
62e85e7
manual: adjust to the nanopass changes
zerbina Jan 20, 2026
49a796c
passes_legacy: remove obsolete parser definitions
zerbina Jan 20, 2026
6b580b7
passes_legacy: adjust to source locs
zerbina Jan 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,25 @@ jobs:
env:
TEST_FILE: tests/expr/t06_call_proc_with_tuple_return_type.test
TEST_OUTPUT: "(TupleCons 100 200) : (TupleTy (IntTy) (IntTy))(Done 0)"

docs:
name: "Test documentation"
runs-on: "ubuntu-latest"

needs: context

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
filter: tree:0

- uses: nim-works/setup-nimskull@0.1.2
with:
nimskull-version: "${{ needs.context.outputs.nimskull-version }}"

- name: Build koch
run: nim c --outdir:bin koch.nim

- name: Build and test documentation
run: bin/koch docs
32 changes: 32 additions & 0 deletions koch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Commands:
generate <dir> generates the various language-related modules
build-defs verifies the language definitions and generates
the textual representation for them
docs builds all documentation
"""
Programs = {
"tester" : ("tools/tester.nim", true),
Expand All @@ -32,6 +33,10 @@ Commands:
DefaultGenerated = "generated"
## the default path for the generated modules

RstList = @[
"nanopass/manual.rst"
]

var
nimExe = findExe("nim")
verbose = true
Expand All @@ -58,6 +63,14 @@ proc compile(file: sink string, name: string, extra: varargs[string]): bool =
args.add file
result = run(nimExe, args)

proc rstToHtml(file: sink string, dir: string, extra: varargs[string]): bool =
## Runs RST-to-HTML conversion on `file`, using `dir` as the
## output directory.
var args = @["rst2html", "--nimcache:build/docs/", "--outdir:" & dir]
args.add extra
args.add file
result = run(nimExe, args)

proc check(file: sink string, extra: varargs[string]): bool =
## Runs the ``check`` command on the given NimSkull `file`.
var args = @["check"]
Expand Down Expand Up @@ -184,6 +197,23 @@ proc buildDefs(args: string): bool =

result = true

proc buildDocs(args: string): bool =
## Handles building and testing the various documentation.
if args.len > 0:
return false

let docroot = getCurrentDir() / "build" / "docs"
createDir(docroot)

for it in RstList.items:
# the output is not relevant at the moment, so it's simply dumped into the
# artifacts directory
if not rstToHtml(it, docroot):
echo "Failure"
quit(1)

result = true

proc showHelp(): bool =
## Shows the help text.
echo HelpText
Expand Down Expand Up @@ -213,6 +243,8 @@ while true:
generate(opts.cmdLineRest)
of "build-defs":
buildDefs(opts.cmdLineRest)
of "docs":
buildDocs(opts.cmdLineRest)
of "help":
showHelp()
else:
Expand Down
2 changes: 2 additions & 0 deletions nanopass/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory contains the implementation of the nanopass framework used by
various parts of Phy.
Loading