Closed athas closed 8 years ago
I guess we also need for a TAIL program to take parameters. In general, I believe we would like a TAIL program to consist of a number of entry points, each of which is a function accepting multiple arguments and returning multiple results. Later we can look at how functions in APL can be specified to translate into entry points in TAIL. We need to extend TAIL with the possibility of writing toplevel functions on the form
fun f (x1:t1,...,xn:tn) : t1'*...*tm' = e
Moreover, we need tuple expressions {x1,...,xn}. We can limit the support for tuple expressions to contexts of the form
C[] ::= let x = e in C[] | []
In this way, tuples can appear only at the toplevel in a function.
For the short term, how will an APL program map to these Tail functions? I like the current approach that uses "magic functions" that we translate to entry point parameters (and possibly return values?). This is because you can define these as actual functions for running the code in classic APL implementations, while still permitting the TAIL and tail2futhark compilers to do their work.
\ Troels /\ Henriksen
Added in 2d1ea971e8c018a6ed95ca44d9e6e87ced67140e. Whatever you write to the screen at the top level (with that operator that looks like a missing font error) will be returned from the generated main function. Pretty hacky, but seems to work. If you write nothing, then the final expression will be assumed to be a floating-point number and will be returned.
At the moment, a TAIL program must return a single floating point value to be compilable to Futhark?. We need to at least support arrays here! How do we do this?