The Mesche Language and Tools https://mesche.cc
 
 
 
 
 
 
Go to file
David Wilson f236a73cd8
ci/woodpecker/push/woodpecker Pipeline was successful Details
compiler: Clean up public C API headers and refactor interfaces (#17)
Fixes #14 by cleaning up the original `mesche.h` public header and providing a standard set of headers for publicly-accessible functionality via the C interface.  There were also a few tweaks to existing interfaces to simplify everything:

- Remove `MescheMemory` and use `VM` for all allocator/deallocator functions
- Move all port functions and types into `io.h` and rename all APIs to start with `mesche_io_*`
- Plus a number of other small tweaks

The goal here is to present a minimal surface area on the public C interface so that we have to be less concerned about breaking changes going forward.  Only the most necessary types and functions were exposed, but more can be added later.

Co-authored-by: David Wilson <david@daviwil.com>
Reviewed-on: #17
2023-06-04 17:14:44 +00:00
.github/workflows ci: Upload library and CLI artifacts to build 2022-11-04 14:06:24 +02:00
components compiler: Clean up public C API headers and refactor interfaces (#17) 2023-06-04 17:14:44 +00:00
scripts compiler: Add support for Emscripten builds 2022-12-01 20:50:01 +02:00
site Add bootstrap.sh script for setting up the project build (#15) 2023-06-03 12:32:53 +00:00
.clang-format Add .clang-format configuration 2022-03-02 10:48:09 +02:00
.gitignore Add bootstrap.sh script for setting up the project build (#15) 2023-06-03 12:32:53 +00:00
.woodpecker.yml Add bootstrap.sh script for setting up the project build (#15) 2023-06-03 12:32:53 +00:00
CMakeLists.txt Add bootstrap.sh script for setting up the project build (#15) 2023-06-03 12:32:53 +00:00
LICENSE Add README.org and LICENSE 2022-02-15 18:43:06 +02:00
README.org Add bootstrap.sh script for setting up the project build (#15) 2023-06-03 12:32:53 +00:00
bootstrap.sh Add bootstrap.sh script for setting up the project build (#15) 2023-06-03 12:32:53 +00:00
guix.scm meta: Use CMake to build the project, add guix.scm (#2) 2023-05-21 10:55:57 +00:00
manifest.scm compiler: Add support for Emscripten builds 2022-12-01 20:50:01 +02:00
project.msc compiler: Add support for Emscripten builds 2022-12-01 20:50:01 +02:00

README.org

Mesche Compiler

Mesche is a programming language that is designed for integration in C applications.

It is used as a high-performance scripting language to drive C applications and enable interactive development of program behavior. The compiler and runtime can be compiled directly into the C application so that this interactivity is available even in shipped applications.

Features

  • Compiles directly to bytecode running on a custom VM
  • First-class functions with closures
  • First-class delimited continuations via reset and shift
  • Tail-call optimization for recursive algorithms and loops
  • Modules can be defined and loaded into Mesche projects
  • Record types with fast setter and accessor functions
  • Native function registration for integrating with C APIs
  • Supports running a VM per OS thread (theoretically, but not tested)
  • Cross-platform build orchestration, dependency management, and release builds with mesche build and mesche cli: https://github.com/mesche-lang/cli

Usage

Build from Source


  git clone https://codeberg.org/mesche/mesche
  ./bootstrap.sh
  cd build
  make

  # Run the REPL!
  components/cli/mesche repl

Build on Guix

I've provided a guix.scm file which makes it easy to build and install local clone of Mesche on Guix:


  guix shell --pure -f guix.scm coreutils

This will build a local Guix Shell environment where you can run mesche repl.

Alternatively, you can open a development shell to build Mesche using the steps in the previous section:


  guix shell --pure -Df guix.scm coreutils
  # .. run cmake, etc ...

Commentary

Principles

  • Simple: The compiler and runtime should be easy to understand and debug.
  • Extensible: The language will be extensible through macros, Mesche modules, and easy registration of C functions into the runtime.
  • Practical: Provides tools to build C/C++ projects that use Mesche (`mesche build`) and also manage project dependencies, especially those containing Mesche modules.

Use cases

  • Developing hackable tools for creative work (video and music production, writing, task management)
  • Game development with the Substratic Engine
  • Mobile application development (in the future)

Should I use this?

Probably not, this project is highly experimental and will probably change frequently. However, if you find the idea interesting and would like to try it, I would certainly be happy to have your feedback!

Future Features

  • A set of persistent data structures a la Clojure
  • Support for Windows, macOS, and Android
  • Hygenic macro definitions following Scheme's design
  • Authoring C API bindings directly in Mesche code to generate C wrappers
  • APIs for working with dynamic arrays of C structures

License

This project is licensed under the BSD 3-Clause License.