Commit 25dae974 authored by Adrian Cochrane's avatar Adrian Cochrane

Expand on syntax, and how to start a program running.

parent 26c9e03d
......@@ -24,10 +24,36 @@ A function is defined in the form "name parameters... `=` expression" where name
"expression" may consist of:
* A square-bracketed and comma seperated list of "name parameters... `=` expression" may precede an expression, defining functions for use exclusively in the following expression or between each other.
* A sequence of identifiers indicates that the first identifier indicates a function to call and the rest should be passed as arguments. Or it may call a variant defined by a type declaration.
* A sequence of identifiers indicates that the first identifier indicates a function to call and the rest should be passed as arguments. Or it may call a variant defined by a type declaration. If not enough arguments are specified the expression returns a function that takes the rest.
* A curly-bracketed and comma seperated list of "name arguments... `=` expression" may follow an expression, for the left hand side to match the variant it ultimately calls and the right hand side indicating what should take it's place.
### Type signatures
At any point between type and function declarations a type signature may be specified. This starts with the name of a function defined in this file followed by a `:`. After this is a prefix-encoded expression of referring to any in-scope type signatures, whether imported or inline. If the function does not have this type compilation should fail.
That is it starts with a type's name followed by any type parameters it requires, the values of which takes on the same structure.
\ No newline at end of file
That is it starts with a type's name followed by any type parameters it requires, the values of which takes on the same structure.
A special type named `Func` takes two type arguments and matches any function which takes the first type as a argument to return a value of the second type. If that second type is itself a function they chain together to specify a function which takes two (or more) arguments.
### Comments
Any text on a line including and after `#` must be ignored.
## Running a program
Each program must contain a function named `main` that takes any subset (including all or none) of the following types defined in the standard library in any order:
* Timeline Mouse
* Timeline Keyboard
* Timeline Touch
* Timeline List Touch
* Timeline GameControl
* Number -- in which case a random number should be generated.
To return:
* Image
* Sound
* List Sound
* a Tuple of any of these (including Timelines)
* a Timeline of any of these (including Tuples)
The interpretor must then map these I/O types to it's window management system as is most appropriate. In doing so the `Timeline` variant `Future` indicates the value must be recomputed at that specified time.
It may optionally also allow the user to pause and resume any of these programs they run.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment