From b91b86a9b63f3a767c8cbf9c46a794fb00a86883 Mon Sep 17 00:00:00 2001 From: seh Date: Mon, 25 Feb 2019 13:49:59 -0600 Subject: add hello world --- .gitignore | 2 ++ HelloWorld/hello.b | 15 +++++++++++++++ README.md | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 .gitignore create mode 100644 HelloWorld/hello.b diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..78af015 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.sbl +*.dis diff --git a/HelloWorld/hello.b b/HelloWorld/hello.b new file mode 100644 index 0000000..2621594 --- /dev/null +++ b/HelloWorld/hello.b @@ -0,0 +1,15 @@ +implement Hello; + +include "sys.m"; +include "draw.m"; + +Hello: module { + init: fn(nil: ref Draw->Context, nil: list of string); +}; + +init(nil: ref Draw->Context, nil: list of string) { + sys := load Sys Sys->PATH; + + sys->print("Hello World! ☺\n"); + exit; +} diff --git a/README.md b/README.md index 852daa8..cc3ac6c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,22 @@ Programming examples in the spirit of [gobyexample](https://github.com/mmcgrana/ These exercises are tested on the [purgatorio](http://code.9front.org/hg/purgatorio/) fork of the Inferno operating system. +The `;` rune in examples indicates a command to be run from the Inferno sh(1) shell. + +## Building + +If a given example provides a mkfile: + + ; mk + +Otherwise, there will only be one file, a Limbo source file which can be built with: + + ; limbo file.b + +You could then run said file with: + + ; file + ## Index [Hello World](./HelloWorld) -- cgit v1.2.3