Skip to content
vczh edited this page Jan 23, 2014 · 6 revisions

A Tinymoe program consists of 3 part: module name, module referencing and function declarations. In order to give an impression, and meaning of the code is written in the comment.

-- A Tinymoe source file should begin with a module name.
-- If several files use the same module name, they are treated as the same module written in different files.
module hello world
-- To complete the task, you may want to reference something from the standard library.
-- The "using" is only for this file, it will not affect other files of the same module.
using standard library

-- Tinymoe doesn't provide any IO feature. In order to print something to the console,
-- the program should tell the host what it want to print.
-- "redirect to" will send all arguments with the string "Print" to the host.
sentence print (message)
	redirect to "Print"
end

-- "phrase main" is the entry for a Tinymoe program (not a module)
phrase main
	-- Invoke a sentence!
	print "Hello, world!"
end