diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-07-18 07:45:58 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-07-18 07:45:58 +0100 |
commit | 8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642 (patch) | |
tree | c53977d1284347bb1d5963ddb4dc7723c40c6e55 /README.md | |
download | micro-lang-8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642.tar.gz micro-lang-8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642.zip |
First public release
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..14b1170 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# Micro Programming Language + +Micro is a small statically typed toy programming language. + +Objectives: + +* Learn and have fun +* Build an interpreter +* (may be) Build a cross-compiler targeting 8-bit microcomputers (Z80 CPU) + * Easy to interact with existing libraries written in other languages +* Fast compilation (compiler) / start-up time (interpreter) +* Micro should be statically typed, small but useful, and reasonably performant (including on the target CPU) + +## Current status + +There is a tree-walk interpreter built in Go mostly following the most excellent [Crafting Interpreters](https://craftinginterpreters.com/) book. It isn't fast, but it can be useful to test code and play around. + +A compiler targeting the Z80 CPU was planned, and that is influencing what is available on the interpreter. Unfortunately this has proven to be more than I can currently tackle, so I'm releasing the interpreter "as is". + +There's a plugin to provide syntax highlighting in vim. The proposed extension for Micro source code is `.micro` or `.cro`. + +### Running the interpreter + +Run a script with `micro file.micro`, or start the REPL with `micro`: +``` +Welcome to Micro <VERSION> +Type in expressions for evaluation, or :q to exit. + +micro> println("Hello micro!"); +Hello micro! +13 +micro> :q +``` + +Also run `micro -h` for the CLI help. + +An example of a program: + +```micro +def fib(n number) number { + if n < 2 { + return n; + } else { + return fib(n - 1) + fib(n - 2); + } +} + +println(fib(20)); +// output: 6765 +``` +Check [the tour](docs/tour.md) for features and details about the language. + +You can also read [the grammar](grammar.md). + +## Copying + +This software is distributed under MIT license, unless stated otherwise. + |