Yes, they just happen to look identical: but that's the crux: How it
looks is the *only* thing that parser/grammar are concerned with.
If it worked like this:
Array Decl ::= Type '[' Ident ']' Ident ';'
Assoc Array Decl ::= Type '[' Ident ']' Ident ';'
...*Then* it would no longer be
%u wfunct...@hotmail.com wrote in message
news:ij3la9$t53$1...@digitalmars.com...
The problem is that it _is_ ambiguous what rule to apply. To me, just
because
static arrays and associative arrays happen to have similar _looks_
doesn't make
parsing them context-free -- they're defined
%u wfunct...@hotmail.com wrote in message
news:ij3la9$t53$1...@digitalmars.com...
Again, just because the AST's _happen_ to _look_ the same for static and
associative arrays, does that mean that this makes D context-free?
Grammar is *just* about how it *looks*, not what it means.
The
Hi,
I think I'm having a little trouble understanding what's meant by context-free
grammar. I've read that D is context-free, but is it really? What about an
expression like:
int[U] s;
? You can't tell -- without looking at the context -- whether U is a data type
or a number, and so because
On Friday 11 February 2011 01:03:21 %u wrote:
Hi,
I think I'm having a little trouble understanding what's meant by
context-free grammar. I've read that D is context-free, but is it really?
What about an expression like:
int[U] s;
? You can't tell -- without looking at the context --
On 02/11/2011 10:03 AM, %u wrote:
Hi,
I think I'm having a little trouble understanding what's meant by context-free
grammar. I've read that D is context-free, but is it really? What about an
expression like:
int[U] s;
? You can't tell -- without looking at the context -- whether U is a data
On Friday 11 February 2011 03:22:54 spir wrote:
On 02/11/2011 10:03 AM, %u wrote:
Hi,
I think I'm having a little trouble understanding what's meant by
context-free grammar. I've read that D is context-free, but is it
really? What about an expression like:
int[U] s;
? You
On 2/11/11 6:03 AM, %u wrote:
Hi,
I think I'm having a little trouble understanding what's meant by context-free
grammar. I've read that D is context-free, but is it really? What about an
expression like:
int[U] s;
? You can't tell -- without looking at the context -- whether U is a data type
That will always parse to an associative array. Then in the semantic pass, if
U
is a constant expression that turns out to be an integer it is reinterpreted as
a
static array.
Ah, interesting. But that describes the implementation (i.e. how the compiler
copes with the ambiguity) and not the
On 2011-02-11 10:37, Jonathan M Davis wrote:
On Friday 11 February 2011 01:03:21 %u wrote:
Hi,
I think I'm having a little trouble understanding what's meant by
context-free grammar. I've read that D is context-free, but is it really?
What about an expression like:
int[U] s;
? You can't tell
10 matches
Mail list logo