Skip to content

Commit 63dee3c

Browse files
committed
Add Gopher Hollyberry implementation
1 parent fdbd136 commit 63dee3c

13 files changed

Lines changed: 1996 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Build artifacts
2+
bin/
3+
dist/
4+
5+
# Temporary debugging tests
6+
tmp/
7+
8+
# Go
9+
*.exe
10+
*.exe~
11+
*.dll
12+
*.so
13+
*.dylib
14+
*.test
15+
*.out
16+
*.log
17+
*.cover
18+
*.prof
19+
*.pprof
20+
21+
# Go work/cache
22+
go.work
23+
go.work.sum
24+
**/.DS_Store
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM golang:1.25-bookworm
2+
3+
# Create non-root user
4+
RUN useradd -m -u 1000 -s /bin/bash builder || true \
5+
&& mkdir -p /work \
6+
&& chown -R 1000:1000 /work
7+
8+
WORKDIR /work
9+
USER builder
10+
11+
# Default shell
12+
SHELL ["/bin/bash", "-lc"]
13+
14+
# Ensure Go toolchain is on PATH for all users (do not rely on inherited PATH)
15+
ENV PATH=/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Multi-stage build for CLI image
2+
ARG BUILDER_IMAGE
3+
FROM ${BUILDER_IMAGE} AS build
4+
5+
WORKDIR /work/impl/go-codex-gpt5-1757426072
6+
7+
# Ensure module files are present before build
8+
COPY . /work/impl/go-codex-gpt5-1757426072
9+
10+
RUN mkdir -p /work/out && \
11+
/usr/local/go/bin/go build -o /work/out/elf ./cmd/elf
12+
13+
FROM debian:bookworm-slim
14+
15+
WORKDIR /work
16+
COPY --from=build /work/out/elf /usr/local/bin/elf
17+
18+
# Minimal runtime dependencies
19+
RUN useradd -m -u 1000 runner || true
20+
USER runner
21+
22+
ENTRYPOINT ["/usr/local/bin/elf"]
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"author": "Gopher Hollyberry",
3+
"details": {
4+
"language": "Go",
5+
"model": "GPT-5",
6+
"harness": "Codex",
7+
"requirements": "Use Go 1.25, without any external packages or dependencies."
8+
},
9+
"progress": {
10+
"stage-1": "complete",
11+
"stage-2": "complete",
12+
"stage-3": "complete",
13+
"stage-4": "complete",
14+
"stage-5": "complete"
15+
},
16+
"journal": [
17+
{
18+
"written_at": "2025-09-09T14:00:19Z",
19+
"entry": "Kickoff: Implementing elf-lang in Go. Focus: Stage 1 lexer + Dockerized CLI. Resume with: make -C ./impl/go-codex-gpt5-1757426072 cli-image"
20+
},
21+
{
22+
"written_at": "2025-09-09T14:04:10Z",
23+
"entry": "Developer tooling ready. Built images: make -C ./impl/go-codex-gpt5-1757426072 build-image && cli-image. Verified CLI: make -C ./impl/go-codex-gpt5-1757426072 run ARGS='tokens tests/stage-1/01_basic_tokens.santat' and tests via make test-stage-1 (all passing)."
24+
},
25+
{
26+
"written_at": "2025-09-09T14:17:00Z",
27+
"entry": "Stage 2 complete: parser + AST implemented; extended lexer; ast pretty-print fixed. Verified: make test-stage-1, test-stage-2 (all green). Resume: make -C ./impl/go-codex-gpt5-1757426072 test-stage-3"
28+
},
29+
{
30+
"written_at": "2025-09-09T14:17:27Z",
31+
"entry": "Starting Stage 3: runtime evaluator. Current status: stage-3 tests all failing (no runtime). Plan: implement value system, environment, eval for literals/vars/lets/arithmetic/puts with exact error strings, then iterate to green. Resume: make -C ./impl/go-codex-gpt5-1757426072 test-stage-3"
32+
},
33+
{
34+
"written_at": "2025-09-09T14:38:24Z",
35+
"entry": "Stage 3 complete: added evaluator (literals, lets/mut, assignment, arithmetic, logical ops, string concat/repeat, integer division, built-in puts and operator functions), printing rules, and CLI run wiring. Verified: make test-stage-1, test-stage-2, test-stage-3 all green. Next focus: Stage 4 collections & indexing. Resume with: make -C ./impl/go-codex-gpt5-1757426072 test-stage-4"
36+
},
37+
{
38+
"written_at": "2025-09-09T15:05:45Z",
39+
"entry": "Stage 4+5 complete: added List/Set/Dict types, indexing, built-ins (push/assoc/first/rest/size/map/filter/fold), partial application, user functions + closures, composition (>>), threading (|>), structural equality, and stable printing. Fixed lexer/parser for zero-arg lambdas (||) and adjusted error messages. Verified: make test across all stages (57/57)."
40+
},
41+
{
42+
"written_at": "2025-09-09T15:09:03Z",
43+
"entry": "Verified Docker images and full test suite (57/57). Updated go.mod to Go 1.25 for consistency. Ready for handoff."
44+
},
45+
{
46+
"written_at": "2025-09-09T15:17:27Z",
47+
"entry": "Verified end-to-end: rebuilt images and ran full test suite (57/57 passing). Cleaned up a leftover debug program file (tmp_closures.santa). Ready for handoff; resume with: make -C ./impl/go-codex-gpt5-1757426072 test"
48+
},
49+
{
50+
"written_at": "2025-09-09T15:23:45Z",
51+
"entry": "Verified images and tests per TASKS.md; 57/57 passing. No changes required."
52+
}
53+
]
54+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
IMPL_NAME := $(notdir $(CURDIR))
2+
IMAGE_PREFIX := local/santa-$(IMPL_NAME)
3+
IMAGE_BUILD := $(IMAGE_PREFIX):build
4+
IMAGE_CLI := $(IMAGE_PREFIX):cli
5+
REPO_ROOT := $(abspath $(CURDIR)/../..)
6+
7+
# Optional flags for docker runs, e.g. --platform linux/amd64
8+
DOCKER_FLAGS := $(SANTA_DOCKER_FLAGS)
9+
10+
.PHONY: *
11+
12+
help:
13+
@echo "Targets:"
14+
@echo " build-image - Build builder image (Dockerfile.build)"
15+
@echo " cli-image - Build CLI image (Dockerfile.cli)"
16+
@echo " shell - Interactive dev shell in builder image"
17+
@echo " exec CMD=... - Run single command in builder image"
18+
@echo " run ARGS=... - Run CLI image with args (tokens/ast/<file>)"
19+
@echo " print-uri - Print docker:// URI for santa-test"
20+
@echo " test - Run santa-test over all tests via docker"
21+
@echo " test-stage-1 - Run santa-test for tests/stage-1"
22+
@echo " test-stage-2 - Run santa-test for tests/stage-2"
23+
@echo " test-stage-3 - Run santa-test for tests/stage-3"
24+
@echo " test-stage-4 - Run santa-test for tests/stage-4"
25+
@echo " test-stage-5 - Run santa-test for tests/stage-5"
26+
@echo " test-file FILE=... - Run santa-test for a single .santat file"
27+
@echo " clean-images - Remove local images for this impl"
28+
29+
build-image:
30+
docker build -f Dockerfile.build -t $(IMAGE_BUILD) .
31+
32+
cli-image: build-image
33+
docker build -f Dockerfile.cli --build-arg BUILDER_IMAGE=$(IMAGE_BUILD) -t $(IMAGE_CLI) .
34+
35+
shell: build-image
36+
docker run --rm -it $(DOCKER_FLAGS) \
37+
-u "$$(id -u):$$(id -g)" \
38+
-v "$(REPO_ROOT):$(REPO_ROOT)" -w "$(REPO_ROOT)" \
39+
$(IMAGE_BUILD) bash
40+
41+
# Usage: make exec CMD="go test ./..." (always in builder)
42+
exec: build-image
43+
docker run --rm $(DOCKER_FLAGS) \
44+
-u "$$(id -u):$$(id -g)" \
45+
-v "$(REPO_ROOT):$(REPO_ROOT)" -w "$(REPO_ROOT)" \
46+
$(IMAGE_BUILD) sh -lc '$(CMD)'
47+
48+
# Usage: make run ARGS="--help" or ARGS="tokens tests/stage-1/01_basic_tokens.santat"
49+
run: cli-image
50+
docker run --rm $(DOCKER_FLAGS) \
51+
-v "$(REPO_ROOT):$(REPO_ROOT)" -w "$(REPO_ROOT)" \
52+
$(IMAGE_CLI) $(ARGS)
53+
54+
print-uri: cli-image
55+
@echo docker://$(IMAGE_CLI)
56+
57+
test: cli-image
58+
cd "$(REPO_ROOT)" && tools/bin/santa-test --bin docker://$(IMAGE_CLI) tests
59+
60+
test-stage-1: cli-image
61+
cd "$(REPO_ROOT)" && tools/bin/santa-test --bin docker://$(IMAGE_CLI) tests/stage-1
62+
63+
test-stage-2: cli-image
64+
cd "$(REPO_ROOT)" && tools/bin/santa-test --bin docker://$(IMAGE_CLI) tests/stage-2
65+
66+
test-stage-3: cli-image
67+
cd "$(REPO_ROOT)" && tools/bin/santa-test --bin docker://$(IMAGE_CLI) tests/stage-3
68+
69+
test-stage-4: cli-image
70+
cd "$(REPO_ROOT)" && tools/bin/santa-test --bin docker://$(IMAGE_CLI) tests/stage-4
71+
72+
test-stage-5: cli-image
73+
cd "$(REPO_ROOT)" && tools/bin/santa-test --bin docker://$(IMAGE_CLI) tests/stage-5
74+
75+
# Usage: make test-file FILE=tests/stage-1/01_basic_tokens.santat
76+
test-file: cli-image
77+
cd "$(REPO_ROOT)" && tools/bin/santa-test --bin docker://$(IMAGE_CLI) $(FILE)
78+
79+
clean-images:
80+
- docker rmi $(IMAGE_CLI) $(IMAGE_BUILD)

0 commit comments

Comments
 (0)