Sign inSign up

hetorusnl/tapl-compyler

By hetorusnl

•Updated 25 days ago

Tim's Awesome Programming Language - Including the Compilers

Image
0

1.5K

hetorusnl/tapl-compyler repository overview

⁠TAPL

Build and publish container Publish VS Code Extension Update Dockerhub Description

Repository with the compiler/examples/documentation of TAPL (Tim's Awesome Programming Language). The VSCode extension can be found here⁠ and language server TODO⁠.

⁠Information

Two compilers are created:

  • compyler: the bootstrapping compiler, written in python
  • tapl/taplc/compiler: the compiler/REPL written in TAPL, compiled using compyler

The compilers compile '.tim' files into c-code, which in turn is compiled in machine code, and run like any other executable.

Homepage: https://tapl-lang.com⁠

⁠Dependencies

  • uv
  • c toolchain (see below)

Example C toolchains are:

  • gcc:
    • gcc
    • clang-format (optional, or set TAPL_C_SKIP_FORMAT="true")
  • clang:
    • clang
    • clang-format (optional, or set TAPL_C_SKIP_FORMAT="true")

⁠Environment variables

NameDescriptionDefault
TAPL_CCThe C compiler to use"clang"
TAPL_CFLAGSThe flags to pass to the C compiler""
TAPL_C_SKIP_FORMATSkips running clang-format when set to "true"""

⁠Docker images

The following docker images, for compyler written in python, are available:

Featuretapl-compylertapl-compyler-small
clang✅❌
gcc❌✅
clang-format✅❌
python (with tapl-compyler)✅✅

Where tapl-compyler is the same as tapl-compyler-full.

The compyler is provided as a docker image, which can be used to compile and run TAPL code. The compyler is an installed python package and added to the path. The entrypoint of the docker image is the compyler, so it can be used as a drop-in replacement for running the compyler locally. The default working directory in the container is /code, where the user's code should be mounted to.

⁠Example usage

Note that 'tapl-compyler' (which is 'tapl-compyler-full') can be substituted with 'tapl-compyler-small'.

# run the current_functionality.tim script from the repository root
podman run --rm -it -v $(pwd):/code hetorusnl/tapl-compyler examples/current_functionality.tim

# run some example_script.tim that exists in the current working directory
podman run --rm -it -v $(pwd):/code hetorusnl/tapl-compyler example_script.tim

# get a shell in the tapl-compyler container, and run a script
podman run --rm --entrypoint "" -it -v $(pwd):/code hetorusnl/tapl-compyler sh
tapl-compyler examples/current_functionality.tim

⁠Usage

Install the uv environment for the compyler by running:

uv sync

Run the following command to watch the tokenizer and AST generator using the unittests and the example .tim files in the test directory, and see the output of the tokenizing and AST generation step:

uv run ptw --now .

Run the following command to compile and run the example with the currently implemented functionality:

uv run tapl-compyler examples/current_functionality.tim

Run the following command to compile and execute any tim file:

uv run tapl-compyler /path/to/file.tim

⁠Needed before AoC

  • collections: list / hmap

⁠'Issues' found during AoC

the following 'features' were found during AoC solving, and should be fixed

  • make char and base/u16-related types be used together
  • implement a list of class instances
  • same symbols multiple times defined should show the correct error, also with functions and lists

⁠TODO

  • fix almost all numeric types are generated as 64bit value
  • enum entries with equal values result in gcc error
  • modules - optional:
    • add --debug-imports flag to warn for wrongly formatted modularized files
    • refactor ModuleError to ModuleProblem, and add ModuleError/ModuleWarning
  • using reserved functions like main result in a c-compiler error
  • add warning for unused variables
  • char type should be generated as u8, not char
  • add error message to the error token and print that instead of "found 'TokenType.ERROR'!"
  • modifiable strings
    • add string class-like thing
    • populate the thing in the ast generator
    • resolve variables during code generation
      • something like below for all vars at once?:
        • sprintf(NULL) for size
        • malloc char array
        • in block scope:
        • sprintf(char array)
  • add list tests
  • clean up list implementation
  • make SourceLocation also able to 'add' a Token/Expression/Statement('s source_location)
  • implement or not allow variable assignment during declaration in class
  • fix open TODOs in tokenizer.py
    • add 0o / e number parsing
    • make distinction between int and float/double numbers
  • fix open TODOs in ast_generator.py
    • add classes
    • add standard library / built-in function, to do print(..)
      • this needs imports
  • fix todos in the typing pass:
    • add fancy error-highlighting/pointing in the source code line(s)
  • allow type 'upscaling', e.g. u8 -> u16 -> u32 -> u64, in typing pass
  • add language server
  • use hypothesis tests: https://hypothesis.readthedocs.io/en/latest/⁠

⁠Ideas

  • add public/private to classes, functions
    • make everything private by default (classes, functions, members)
  • REPL
    • use Tom's "hot-reload" functionality to 'inject' REPL lines
    • store persistent variables somewhere

⁠FAQ

⁠License

MIT License, Copyright (c) 2026 Tim Klein Nijenhuis [email protected]⁠

Tag summary

Content type

Image

Digest

sha256:a6f0e0749…

Size

175.6 MB

Last updated

25 days ago

docker pull hetorusnl/tapl-compyler