Skip to content

Comments

Enable running course module programs end-to-end#28

Merged
associate-1 merged 1 commit intomainfrom
feat/course-module-runnable
Feb 20, 2026
Merged

Enable running course module programs end-to-end#28
associate-1 merged 1 commit intomainfrom
feat/course-module-runnable

Conversation

@associate-1
Copy link
Member

Summary

  • String escape conversion: Occam string escapes (*c, *n, *t, *s, **, *', *") are now converted to real bytes in the parser, so "Hello World*c*n" produces correct Go output ("Hello World\r\n")
  • Main harness generation: PROCs with the standard occam entry point signature (CHAN BYTE keyboard?, screen!, error!) automatically get a generated func main() that wires stdin/stdout/stderr to byte channels via buffered I/O goroutines
  • Example and docs: Added examples/course_hello.occ and updated README with a walkthrough for transpiling and running programs that use the KRoC course module

Test plan

  • go test ./parser -run TestStringEscape — parser converts all occam escape sequences correctly
  • go test ./codegen -run TestStringEscapeCodegen — codegen emits correct Go string with \r\n
  • go test ./codegen -run TestE2E_HelloWorldCourseModule — full pipeline: preprocess → transpile → compile → run hello_world.occ, verify output
  • go test ./... — all existing tests still pass
  • Course module go vet regression: ./occam2go -I kroc/modules/course/libsrc -D TARGET.BITS.PER.WORD=32 -o /tmp/course_out.go kroc/modules/course/libsrc/course.module && go vet /tmp/course_out.go

🤖 Generated with Claude Code

Convert occam string escape sequences (*c, *n, *t, *s, **, *', *") to
real bytes in the parser, and generate a main() harness for PROCs with
the standard entry point signature (CHAN BYTE keyboard?, screen!, error!)
that wires stdin/stdout/stderr to byte channels. Programs using the KRoC
course module can now be transpiled, compiled, and run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@associate-1 associate-1 merged commit 05e194b into main Feb 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants