diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-08-12 22:53:06 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-08-12 22:53:06 +0100 |
commit | 279f04cb63e45ceb9a9df82540d5362565b8b37b (patch) | |
tree | bf71e8d7829e6ccf29320dacaf7c4742423683c5 /README.md | |
download | micro-lang-hs-279f04cb63e45ceb9a9df82540d5362565b8b37b.tar.gz micro-lang-hs-279f04cb63e45ceb9a9df82540d5362565b8b37b.zip |
Initial import
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..e0d8eb0 --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# Micro2 + +This is not necessarily related to [Micro](https://git.usebox.net/micro-lang/about/), but I couldn't find a better name. + +Micro2 is a small statically typed toy programming language. + +Objectives: + +- Learn Haskell and have fun +- Build a compiler +- (may be) Targeting 8-bit microcomputers (Z80 CPU) + - Easy to interact with existing code written in C/ASM +- (may be) Targeting WASM +- Fast compilatio +- Statically typed, small but useful, and reasonably performant (including on the target) + +## Current status + +This is a **work in progress**. + +Currently the compiler uses parsec (Monadic parser combinators) following this planned pipeline: + +* Lexer +* Parser +* Analyzer + * semantic analysis, type-check, fold constant, etc +* Generator: emit intermediate code for the target (e.g. ASM files) + * (maybe) Intermediate representation + +## How to build it + +Requires Haskel and Cabal: + +``` +cabal install micro2 +``` + +## Running the compiler + +TODO + +### How does it look like? + +This is an example of a micro2 program: + +``` +def fib(n: u16): u16 { + if n < 2 { + return n; + } else { + return fib(n - 1) + fib(n - 2); + } +} + +fib(20); // 6765 +``` + +### COPYING + +This software is distributed under license GPL, unless stated otherwise. See [COPYING](COPYING) file for further details. |