From 9f71d7248c908900e987c08b2ab4642dfd88eacb Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 26 Mar 2021 22:32:22 -0700 Subject: . --- mu.md | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'mu.md') diff --git a/mu.md b/mu.md index 9bd37b67..34149a29 100644 --- a/mu.md +++ b/mu.md @@ -43,7 +43,9 @@ and [vocabulary.md](vocabulary.md). ## Functions and calls -Zooming out from single statements, here's a complete sample program in Mu: +Zooming out from single statements, here's a complete sample program in Mu +that runs in Linux (Mu programs without an OS need `main` to have a different +signature): ex2.mu @@ -82,17 +84,6 @@ You can exit a function at any time with the `return` instruction. Give it the right number of arguments, and it'll assign them respectively to the function's outputs before jumping back to the caller. -The function `main` is special; it is where the program starts running. It -must always return a single int in register `ebx` (as the exit status of the -process). It can also optionally accept an array of strings as input (from the -shell command-line). To be precise, `main` must have one of the following -two signatures: - -- `fn main -> _/ebx: int` -- `fn main args: (addr array (addr array byte)) -> _/ebx: int` - -(The name of the inout is flexible.) - Mu encloses multi-word types in parentheses, and types can get quite expressive. For example, you read `main`'s inout type as "an address to an array of addresses to arrays of bytes." Since addresses to arrays of bytes are almost -- cgit 1.4.1-2-gfad0