Myrddin Compiler
C JavaScript Shell Assembly Yacc Roff Other
Clone or download
oridb Fix codegen bug in env capture.
	We could capture too little in the env, because we didn't
	account for padding in the captures.
Latest commit 7439e43 Jul 21, 2018
Permalink
Failed to load latest commit information.
6 Fix codegen bug in env capture. Jul 21, 2018
bench Add benchmark for bigint multiplication. Mar 17, 2018
doc Add documentation for tuple access expressions Jul 20, 2018
examples Move stuff to examples. Jul 4, 2018
lib Fix typo in generic sleq implementation Jul 13, 2018
mbld Make bio and regex disposable. Jul 14, 2018
mi Support direct tuple access operators "tuple.N" Jul 20, 2018
mk Move stuff to examples. Jul 4, 2018
muse Add 'loaduses()' to muse. Jan 19, 2018
parse Support direct tuple access operators "tuple.N" Jul 20, 2018
rt Define __guard_local on OpenBSD for linking libc Jan 15, 2018
support Move nix packaging to the appropriate place. May 12, 2018
test Support direct tuple access operators "tuple.N" Jul 20, 2018
util Fix murmurhash2 when string length is a multiple of a 4 Jul 18, 2017
.gitattributes Fix handling '\r\n' with libbio. Oct 4, 2015
.gitignore Add test for bio skipto. Feb 1, 2018
LICENSE Merge pull request #1 from akoshibe/master Jun 18, 2014
Makefile Make bootstrap more seamless. Jun 28, 2018
README.md mention make bootstrap as a potential step Nov 18, 2017
bld.proj Move stuff to examples. Jul 4, 2018
bld.tags Add semaphores and wrapper for various futexesque system calls Jun 23, 2018
configure GC sections by default. Jan 27, 2018
genbootstrap.sh Use chartype functions to determine character type, regenerate bootstrap Jun 15, 2018
mbldwrap.sh Make bootstrap more seamless. Jun 28, 2018
mkfile Apply the same bootstrap changes to 9front. Jun 28, 2018

README.md

Myrddin

Myrddin Website and Documentation

Myrddin is a systems language that is both powerful and fun to use. It aims for C like low level control, a lightweight high quality implementation, and features you may find familiar from languages like like rust and ocaml.

This combination makes Myrddin suitable for anything ranging from desktop applications, to embedded systems and potentially even kernel development.

Build

If you are building from development then issue make bootstrap after the call to ./configure.

  • ./configure
  • make
  • make install

The result will be, among other things, the binaries 6m and mbld.

Usage

Compile and execute: mbld -R test.myr

Compile into a binary: mbld -b binary test.myr

Examples

A classic:

use std

const main = {

	for var i = 0; i < 1000; i++
		/* pattern match on a tuple */
		match (i % 3, i % 5)
		| (0, 0): std.put("fizzbuzz\n")
		| (0, _): std.put("fizz\n")
		| (_, 0): std.put("buzz\n")
		| _:
		;;
	;;
}

How about regex, destructuring and algebraic data types?

use regex
use std

const main = {
	var re, str

	str = "match against this!"
	match regex.compile(".*")
	| `std.Ok r:	re = r
	| `std.Err m:	std.fatal("couldn't compile regex: {}\n", m)
	;;
	match regex.exec(re, str)
	| `std.Some _:  std.put("regex matched\n")
	| `std.None:	std.fatal("regex did not match\n")
	;;
	regex.free(re)
}

More examples and a complete feature list can be found on the website.

Status

Solid Engineering

Try It Online

The online playground is a good place to get started with little setup.

Online Playground Environment

API Documentation

Myrddin ships with standard library which covers many common uses. It is becoming more useful every day.

API Reference

Mailing List

Annoucements of major changes, questions, complaints. We also give relationship advice.

Mailing List Archives

Subscribe Here

Supported Platforms

Myrddin currently runs on a number of platforms

  • FreeBSD
  • Linux
  • NetBSD
  • OSX
  • OpenBSD
  • Plan9front