Work in progress at the moment but I wanted to get feedback on syntax. The honu syntax looks like:
// binary_operator <name> <prec> <assoc> <binary transform>
// unary_operator <name> <prec> <unary transform>
binary_operator raise 10 left {
function (left, right) {
syntax(pow(left, right))
}
}
Some ideas using our syntax:
binary_operator raise 10 left ($left, $right) {
return #{Math.pow($left, $right)}
}
// $left and $right are implicit (or $lhs, $rhs)
binary_operator raise 10 left {
return #{Math.pow($left, $right)}
}
// could decide binary vs. unary by existence of assoc operator
operator raise 10 left {
return #{Math.pow($left, $right)}
}
operator neg 10 {
return #{-$op}
}
// using arrow
operator raise 10 left { $lhs, $rhs } => {
return #{Math.pow($lhs, $rhs)}
}
// haskelly way (too terse IMO)
infixl 10 raise {
return #{Math.pow($left, $right)}
}
left operator 10 {
return #{Math.pow($left, $right)}
}
Any other ideas?