/* * After I've written 3'000 lines of code of my AEC-to-WebAssembly compiler, * I should finally be able to compile some simple AEC programs so that they * can run in a browser. */ Function add(Integer32 first, Integer32 second) Which Returns Integer32 Does Return first+second; EndFunction Function subtract(Integer32 first, Integer32 second) Which Returns Integer32 Does Return first-second; EndFunction Function multiply(Integer32 first, Integer32 second) Which Returns Integer32 Does Return first*second; EndFunction Function integerDivision(Integer32 first, Integer32 second) Which Returns Integer32 Does Return not(second=0)? first/second : 0; //Protect yourself from division //by zero, by returning 0 then. //Doesn't make perfect sense, but //probably makes more sense than //crashing the program. EndFunction Function modulo(Integer32 first, Integer32 second) Which Returns Integer32 Does Return not(second=0)? mod(first,second) : first; //Have a better idea //what to do when the //second number is 0? EndFunction Function decimalDivision(Integer32 first, Integer32 second) Which Returns Decimal32 Does Return Decimal32(first)/second; //"Decimal32(" here is the casting //operator, equivalent to the //C casting operator "(float)" EndFunction Function maximum(Integer32 first, Integer32 second) Which Returns Integer32 Does Return (first>second)? first : second; EndFunction Function minimum(Integer32 first, Integer32 second) Which Returns Integer32 Does Return (first