A minimalistic programming language written in C89.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ludovic 'Archivist' Lagouardette 3d39b4e3d6 Made the GC reclaim successful routines 6 months ago
test The most practical way to print "Hello World" 6 months ago
.gitignore Fixed a bug where routine list was not properly resized 6 months ago
CMakeLists.txt Fixed a bug where routine list was not properly resized 6 months ago
LICENSE Added README.md contents 6 months ago
README.md Fixed a bug where routine list was not properly resized 6 months ago
bench.c Added coroutine handling 6 months ago
ink.h Fixed a bug where routine list was not properly resized 6 months ago
lib.c Made the GC reclaim successful routines 6 months ago
main.c Added garbage collection (and a memory corruption bug) 6 months ago

README.md

ink

ink is a minimalistic interpreted programming language, tentatively implemented exclusively in C89. It features coroutines and can currently only manipulate integers. Part of the code may not be compliant with C89 and I will try to fix that in time.

It is fully self-contained and doesn't rely on a working standard library beyond the following:

  • malloc
  • realloc
  • free
  • putchar

To make the library not use the standard library, build it with NOSTDLIB defined as a preprocessor directive.

All of these functions need to work for ink to work. It is easy to add new functions to the interpreter. I added a garbage collector to handle cleaning dynamically allocated resources.

It is possible to segregate unsafe allocations (allocations that should be hidden from the interpreter) by setting the inner_ versions of the library functions to different allocation functions.

Limits

  • Token size is limited to 127 bytes (see ink_lex)
  • Values and indices are limited to the platform size of int
  • Main function has a size limit of 256 tokens (see ink_compile)
  • Functions have a size limit of 256 tokens (see ink_parse)
  • Functions have a count limit 128 labels (see ink_parse)
  • Only non-main functions can use labels