8000 GitHub - HetorusNL/tapl: Tim's Awesome Programming Language - Including the Compilers
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

HetorusNL/tapl

Repository files navigation

TAPL

Repository with the compiler/examples/documentation of TAPL (Tim's Awesome Programming Language).

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
  • gcc
  • clang-format

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

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

uv run -m src.compilers.compyler examples/current_functionality.tim

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

uv run -m src.compilers.compyler /path/to/file.tim

TODO

Ideas

  • add public/private to classes, functions
  • make everything private by default (classes, functions, members)
  • implicit "python modules' class imports", example:
    • modules/some_module.tim: class SomeModule: // blabla
    • file.tim: from module import SomeModule
  • REPL
    • use Tom's "hot-reload" functionality to 'inject' REPL lines
    • store persistent variables somewhere
  • add returnif keyword-like thing:
    • an indented block of statements follow this
    • if a statement returns a non-null value, return this from the surrounding function
    • example below

Examples

returnif:

Statement statement():
    // very neatly functions returning if they are non-null
    returnif:
        if_statement()
        for_loop_statement()
        print_statement()
        while_loop_statement()

    // outside of the block use a normal return statement
    Expression e = expression()
    return ExpressionStatement(e)

FAQ

License

MIT License, Copyright (c) 2025 Tim Klein Nijenhuis tim@hetorus.nl

About

Tim's Awesome Programming Language - Including the Compilers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published

Languages

0