ImplFirstCode
From dis-Emi-A
A compiler needs to be created that will be able to compile the following piece of code fully. This will be a first step into creating the experimental compiler/language. The requirements for the functioning of the code will be listed below it.
add :> x, y -> z
{
z = x + y;
}
Note that we also intend for the short-form of this function to work, but after the long-form is working:
add :> x, y -> x + y
The requirements for the implementation:
- The output will be a shell command
- thus the compiler must be able to choose a single function for output
- command-line arguments must be parsed into their target object type
- obviously the + is only implemented on numbers, so this must compile a numeric version
- however, when exposing to the shell a fixed type is needed?
- all error conditions must be captured (and reported to the shell automatically)
- overflow
- underflow
- precision loss
- syntax error (in argument parsing)
- the return value must be automatically converted to an appropriate shell display (on stdout)
