]> ocean-lang.org Git - ocean/commit
oceani: Add functions
authorNeilBrown <neil@brown.name>
Sun, 7 Nov 2021 21:21:30 +0000 (08:21 +1100)
committerNeilBrown <neil@brown.name>
Fri, 12 Nov 2021 23:09:44 +0000 (10:09 +1100)
commit17b2c8c16fd6dadf052fefc20e2ee8c7f8c3da0b
treeb519849e5684189a9310f448f8e4c9c393ebabef
parent6526e62830ba607ffd914cfc44e2bb90c5405f86
oceani: Add functions

As yet, functions cannot return a value, but they can be passed
parameters.
They are declared a bit like consts, but there isn't a common
header for multiple constants.

A pointer to the body of the function is stored in the 'global' area,
like the vale of any other constant.

Functions can be called as a statement - providing they don't return
anything - or as an expression, which will currently be a type error as
they cannot return the correct type.

We allocate a new 'local' frame for each function call, and free it when
the function completes.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/oceani-tests.mdc
csrc/oceani.mdc