Here's a couple example programs.
hello_world.mjut
# Print a simple hello world message
let msg :: &Char = "Hello, world!\n"
mutate:
- stdout write msg
truth_machine.mjut
# Truth machine - if you input a 1, it prints 1 forever
# But a 0, it prints 0 & quits
let inp :: Char = 0
mutate:
- stdin alloc_read_line # Read data into stdin :: &Char
- inp := stdin:0
- inp -= '0'
- if inp - goto quit;
- forever:
+ stdout write "1"
+ goto forever
- quit:
+ stdout write "0"
I think I have it fleshed out enough to get a basic version working. I'll write up a lexer and parser tomorrow (it's after midnight, so actually today lol) probably
Python - 94 chars
I tried using some alternatives, but they all ended up more verbose than:
The list tools in python are great, but they all use keywords, so doing anything that doesn't directly do for and print is likely too much. You could make a list of strings for instance, and print it all out at once to save a 'print' but you'd end up using a for in list comprehension or a join or something, so you can't really save any characters afaict.
I'm sure someone will find a way to beat it tho!