>>107635861
>how can I tell that the function name is +, and not 'a'?
The choice is really between two grammars:
expr = id | apply
apply = id ids
expr = id | apply | add
apply = id ids
add = expr "+" expr
When "a + b" is read in the first grammar + would need to be reflowed up the tree to function application position, basically rewriting it "+ a b", + needs to be marked as infix prior to its first use (often with a keyword or by grouping it like (+)). In the second grammar "a + b" explicitly parsed, add nodes in the tree would later be retyped to apply nodes. It's up to you which is more minimal
>I want to have a minimal syntax in my functional language. The best I can come up with is basically structs, but then that makes parameter passing strange.
>If I don't have parameters in the declaration, then infix function name disambiguation is trivial, but then how should I define positional parameters in a minimal way?
How *ml might do both with structs:
-- possible f definitions
f x = x.a + x.b -- x struct parameter
Comment too long. Click here to view the full text.