On Thu, Mar 12, 2009 at 11:45 AM, Jonathan S. Shapiro <[email protected]> wrote:
> Yeah. That occurred to me about 20 minutes after I sent my response.
>
> The down side of a high rate of progress is a correspondingly high
> rate of fuck ups. Thankfully, also a high rate of recoveries.
>
> Meanwhile, I'm finding that the "top vs. nexted" expr thing isn't
> looking all that wonderful. Looking at the grammar I'm starting to
> think that it's going to be hard to explain.
>
> OTOH, if we adopt the "apply to unit" idiom, then *all* multi-arg
> applications once again involve parens, and at that point the
> syntactic ambiguity may turn out to solve itself. I'm going to check
> that out.
That doesn't follow from my understanding of the apply to unit idiom,
so can you explain why all multi-arg applications would involve
parens?
In ocaml/haskell/etc., all functions take at least one argument, and
parentheses only need to occur in one of the arguments is a unit.
E.g.,
f : () -> int
g : int -> int
h : int -> int -> int
f ()
g 1
h 1 2
I would imagine a grammar of the form
exp = arg | arg arglist | exp + exp | ...
arg = ident | literal | ( exp ) | ...
arglist = arg | arglist arg
I believe this unambiguously parses
f a b c + g a b + (g a b) c + g c (a b)
since "f a b c" can't be parsed as "{f a b} c" since "f a b" isn't a valid arg.
Geoffrey
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev