proj-oot-ootMainCore

Part of Oot Details.

Read Oot first.

TODO: mb rename Oot Core to 'Oot Mu', and use 'Oot Core' to refer to 'standard Oot minus the stdlib'

Details of Oot Core

The syntax of Oot and Oot Core are identical, and so has already been explained above. All that remains is to describe the builtin identifiers and operators.

General remarks on Oot Core

Common platform primitives which are special cases of more general primitives, or compositions of other primitives (for example: increment; xor; multiply-and-accumulate), are usually not in Oot Core, but they are in the Oot Standard Library. Since they are in the Standard Library, Oot implementations do not have to provide platform-specific implementations of these, but they may if they choose.

goto

targets a label

note that labels are 'first-class'; they can be assigned to variables (todo, how to quote them?)

todo: what limits on goto? i'm thinking: label must be within the current block, or its lexical ancestors; eg stack unwinding is done but not winding, that is you can't jump into the middle of another function? otoh do we really want to do unwinding, what about coroutines? probably we need some guileVM-like details here to present different options. Should be at least as powerful as computable goto as sometimes seen in C.

while

rep

(like "for" but "rep", short for "repeat" is thought to be easier to understand for beginners)

gcond

gcond is 'generalized cond'; it takes one argument, which is a comparison function, and returns a cond-like function

break

break-to-enclosing-label

intended to handle one of the 3 common usecases of goto in otherwise structured programming (break-to-enclosing-label/continue-to-enclosing-label, try/catch/finally, dispatch)

continue

continue-to-enclosing-label

intended to handle one of the 3 common usecases of goto in otherwise structured programming (break-to-enclosing-label/continue-to-enclosing-label, try/catch/finally, dispatch)

emit

note: try/catch/finally is intended to handle one of the 3 common usecases of goto in otherwise structured programming (break-to-enclosing-label/continue-to-enclosing-label, try/catch/finally, dispatch); note that in this role propagation up a handler tree is not needed, in fact no message passing at all is needed; that use SHOULD be well-optimized

tail call optimization

module

#include

imp

import

coercions

equality

ordering

Boolean logic

arithmetic

get/set, apply

todo explain that these are typeclass-ish 'protocols'

composite values

types

(there is no 'type' function, see the 'type system' section)

todo: more minimal basis set of the above; leave the rest to Oot; remember, platforms can optimize stuff in Oot, not just in Oot core? or otoh do we want Oot Core alone to be a good target for compilers? Yeah, probably the latter.. but then do we want to add the trig fns back in? and add more comparison ops, etc, from Oot? and while loops and switches (conds)?

todo: but we may want to at least drop the stuff that even webassembly couldnt handle in their MVP, eg pow, e, pi, log (otoh LuaVM? has a POW opcode). Not sure tho, they plan to get to that later. Otoh there will probably be embedded platforms where these are unavailable and unneeded, so mb drop them. Otoh there will be embedded platforms without floats at all, so does that mean we should drop inf, nan?

todo : what does LuaVM? have that we don't yet? (see [1]):

todo: what, if any, are LuaVM?'s restrictions on jmp targets?

summary:

todo:

'Oot' is built around a simple subset of itself called Oot Core. So,

todo

note: oot core and oot have thee same lexer and parser, but oot has a bunch of macros and metaprogrammed syntax that oot core does not

teach oot core first, then oot, then metaprogramming

todo