Skip to content

Commit 14db7e0

Browse files
committed
Adds the initial scaffolding for zpy and zz.
Signed-off-by: Amy Ringo <me@remexre.com>
1 parent e235931 commit 14db7e0

File tree

9 files changed

+65
-3
lines changed

9 files changed

+65
-3
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2025 ukoOS Contributors
1+
# SPDX-FileCopyrightText: 2025-2026 ukoOS Contributors
22
#
33
# SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -42,6 +42,7 @@ endef
4242
# Information about the build to perform.
4343
include $(srcdir)/doc/include.mak
4444
include $(srcdir)/src/kernel/include.mak
45+
include $(srcdir)/src/zz/include.mak
4546

4647
# Load the target.
4748
ifeq ($(realpath $(srcdir)/src/targets/$(arch)/$(target).mak),)

REUSE.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ SPDX-FileCopyrightText = "2025 ukoOS Contributors"
77
SPDX-License-Identifier = "GPL-3.0-or-later"
88

99
[[annotations]]
10-
path = ["README.md", "doc/**.md", "doc/**.png", "doc/**.jpg"]
10+
path = ["README.md", "doc/**.md", "doc/**.png", "doc/**.jpg", "src/**.md"]
1111
precedence = "aggregate"
12-
SPDX-FileCopyrightText = "2025 ukoOS Contributors"
12+
SPDX-FileCopyrightText = "2025-2026 ukoOS Contributors"
1313
SPDX-License-Identifier = "CC-BY-SA-4.0 OR GFDL-1.3-or-later"
1414

1515
[[annotations]]

doc/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
- [Overview](./kernel/mm/overview.md)
1515
- [Memory map](./kernel/mm/memory-map.md)
1616
- [Booting](./kernel/mm/booting.md)
17+
- [Z]()
18+
- [Introduction](./z/introduction.md)
1719
- [Targets](./targets.md)
1820
- [Tutorials](./tutorials/tutorials.md)
1921
- [First Day](./tutorials/first-day.md)

doc/z/introduction.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Introduction
2+
3+
The Z language is an efficient Lisp dialect.
4+
5+
Z is relatively similar to Common Lisp; a programmer new to Z without existing Common Lisp experience should assume that it's similar to Python.

src/zpy/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# zpy
2+
3+
A bootstrap interpreter for the Z language, written in Python.
4+
See the documentation for more about the language.
5+
6+
This interpreter runs on the host at build-time, and is used to interpret the `zz` compiler and run it on itself, producing the binary we actually ship.

src/zpy/main.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python3
2+
3+
# SPDX-FileCopyrightText: 2026 ukoOS Contributors
4+
#
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
7+
from pathlib import Path
8+
from sys import argv
9+
10+
11+
def main(src_path: Path, *args: str):
12+
with src_path.open() as src_file:
13+
src = src_file.read()
14+
15+
pass
16+
17+
18+
if __name__ == "__main__":
19+
main(Path(argv[0]), *argv[1:])

src/zz/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# zz
2+
3+
A compiler for the Z language, written in Z.
4+
See the documentation for more about the language.

src/zz/include.mak

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: 2026 ukoOS Contributors
2+
#
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
all:: src/zz/zz.elf
6+
install:: src/zz/zz.elf
7+
install -DT src/zz/zz.elf $(DESTDIR)$(prefix)/sys/zz.elf
8+
9+
# Bootstrap zz.
10+
src/zz/zz.elf: $(srcdir)/src/zpy/main.py $(srcdir)/src/zz/main.z
11+
@mkdir -p $(dir $@)
12+
@echo "ZPY $@"
13+
$(Q)$(PYTHON3) $(srcdir)/src/zpy/main.py \
14+
$(srcdir)/src/zz/main.z \
15+
$(srcdir)/src/zz/main.z

src/zz/main.z

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
;; SPDX-FileCopyrightText: 2026 ukoOS Contributors
2+
;;
3+
;; SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
(defun main ()
6+
(+ 40 2))
7+
8+
(1+ (* 2 (+ 19 (main))))
9+
10+
;; vi: set ft=lisp :

0 commit comments

Comments
 (0)