ImplFirstCode

From dis-Emi-A

Jump to: navigation, search


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:

  1. The output will be a shell command
    1. thus the compiler must be able to choose a single function for output
    2. command-line arguments must be parsed into their target object type
  2. obviously the + is only implemented on numbers, so this must compile a numeric version
    1. however, when exposing to the shell a fixed type is needed?
  3. all error conditions must be captured (and reported to the shell automatically)
    1. overflow
    2. underflow
    3. precision loss
    4. syntax error (in argument parsing)
  4. the return value must be automatically converted to an appropriate shell display (on stdout)
Personal tools