This relates to one of the "big points" which I periodically try to make
about parsers and languages. I believe that when it comes to
programming languages we've brain-washed ourselves to like unreadable
syntax, because that's all traditional parsers could parse, and a line
with lots of chicken-scratch-punctuation has come to look "professional"
to us.
But what kind of syntax do we really find most readable? The answer
lies in the kind of syntax do we use when we know we have powerful
parsers available. The most powerful parsers we have at present are
human beings, and for them we write lightly-punctuated text, like this
sentence.
Anyway, that's why "interface 2" and not ":default interface => 2".
It's a style issue.
But actually, there's more. You might point out that "":default
interface => 2" is like what I've been doing in the SLIF. So what's
going on here? The answer lies in a change that I made much of at the
time, but I think went pretty much unnoticed nonetheless. The SLIF is
now an ambiguous language. That is, it allows it's syntax to be
potentially ambiguous. Any actual ambiguities are flagged as errors,
and there was ways to disambiguate them. One is that the SLIF now
allows a semi-colon as a statement separator, something I've yet to
document.
Anyway, the fact that the SLIF is now ambiguous means I now longer have
to be careful about avoiding ambiguities. When I had to be careful, I
did things like ":default interface => 2". Now potential ambiguity is
OK, so I will start to do things like "interface 2".
By the way, I believe use of potential ambiguity in programming
languages will be a significant advance. With ambiguity comes power.
That's how natural languages work. And that is how programming
languages should work.
I hope you don't regret asking. :-) -- jeffrey
On 02/15/2014 03:47 PM, Ron Savage wrote:
(1) Why:
interface 2
and not:
interface => 2
Or even
:default => interface => 2
And yes, it's rather longer. But saying ':default' is a good thing
(i.e. a heads-up) for beginners...
--
You received this message because you are subscribed to the Google Groups "marpa
parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.