Sounds like the same as in Scala: http://www.scala-lang.org/node/118
> Perhaps I am missing a huge parsing problem that would make this feature
> impractical. Or maybe it just isn't a worthwhile feature. Thoughts?
Parsing (e.g. in gofmt) of source according to your proposal would
require to create a symbol table and perform semantic analysis of the
declared and/or imported entities even when what's needed is just a
(now) simple syntax validity check and/or capturing the nesting
structure of blocks. That's IMO (obviously) unacceptable.
-bflm
Bflm,
I don't see why. Can you explain? The parser doesn't need a symbol table to recognize method calls now. I don't see how the second, equally simple syntax is any different.
I'm not a parser expert so pardon my ignorance, but it seems to me that both syntaxes are LL1.
Ryanne
- from my phone -
On Feb 6, 2010 7:46 AM, "befelemepeseveze" <befeleme...@gmail.com> wrote:
On 6 ún, 10:48, Ryanne Dolan <ryannedo...@gmail.com> wrote:
> Perhaps I am missing a huge parsing p...
Esko,
Good call. Scala seems to work exactly this way.
Anyone see why it wouldn't work/fit with go?
Ryanne
- from my phone -
Bflm,
As I understand, symbol tables during parsing are only necessary to resolve ambiguities in the language. How does my proposal add ambiguities?
- from my phone -
On Feb 6, 2010 10:59 AM, "Ryanne Dolan" <ryann...@gmail.com> wrote:
Bflm,
I don't see why. Can you explain? The parser doesn't need a symbol table to recognize method calls now. I don't see how the second, equally simple syntax is any different.
I'm not a parser expert so pardon my ignorance, but it seems to me that both syntaxes are LL1.
Ryanne
- from my phone -
>
> On Feb 6, 2010 7:46 AM, "befelemepeseveze" <befeleme...@gmail.com> wrote:
>
> On 6 ún, 10:48, Ryanne Dolan <ryannedo...@gmail.com> wrote:
> Perhaps I am missing a huge parsing p...
>
>
> Parsing (e.g. in gofmt) of source according to your proposal would
> require to create a symbol...
It has been mentioned in a previous mail:
Let X == a P b Q c,
and Y == a > b < c.
X may be a valid expression if, for example, P == + and Q == -. X is
an invalid expression if P == > and Q == <, then X == Y. Currently Y
can be rejected by a parser without having a symbol table. In
contrary, X can be accepted/rejected iff the parser knows what kind of
operators P and Q are, thus the symbol table must be consulted for P
and Q definitions.
Similarly, P and/or Q could be declared as a non operator declaring
identifier (e.g. a variable name), rendering X invalid in another
(ambiguous) way and again this can be detected only by checking what P
and Q is in the symbol table, probably producing an error disjoint to
the former case.
-bflm
Currently Y can be rejected by a parser without having a symbol table.
Similarly, P and/or Q could be declared as a non operator declaring identifier (e.g. a variable name), rendering X invalid in another (ambiguous) way and again this can be detected only by checking what P and Q is in the symbol table,
bflm,I see your point. I wonder if the problem is quite as big as you make it tho.Y == a > b < cThis would be the same asY == a.gt(b).lt(c)which is only invalid because gt returns a bool, and lt cannot be called on a bool. Of course, you could have gt/lt return Bool, withtype Bool booland thenY == a gt b lt ccould be valid.
> I think you are confusing parsing with compiling.
It is now possible to detect some invalid expressions (outside the
domain of compiling - highlighter, formatter, debugger evaluator, ...)
with a few regexps and optionally a CF grammar on top of them. This
property (or part of it) would be lost, the language and it's current
easy handling in some areas even outside of the compiler would become
IMO worse. Anyway, I'm, of course, not the decision maker in what
regards Go language design.
-bflm
On 8 ún, 09:27, Ryanne Dolan <ryannedo...@gmail.com> wrote:It is now possible to detect some invalid expressions (outside the
> I think you are confusing parsing with compiling.
domain of compiling - highlighter, formatter, debugger evaluator, ...)
with a few regexps and optionally a CF grammar on top of them. This
property (or part of it) would be lost,
On 8 February 2010 12:06, Honza <befeleme...@gmail.com> wrote:
If I'm not wrong, then you should soon see for yourself, that with
your proposal it wouldn't be anymore possible to build the AST without
the symbol table. Among other things, package go/parser would become
unusable in it's current implementation and I do expect the same
applies to essential parts of gccgo and *g compilers. They'll not be
able to rely on yacc generated parsers anymore.
[It's not my proposal.]
The difference between these two:
a = b.Plus(c).Times(d)
a = b + c * d
is certainly more dramatic, but it is also even more complex to
specify and implement.
Personally, I don't think the small difference between these two:
a = b.Plus(c).Times(d)
a = b Plus c Times dis worth the extra complexity.
The difference between these two:
a = b.Plus(c).Times(d)a = b + c * d
is certainly more dramatic, but it is also even more complex to
specify and implement.
Then you have to define those, operator methods of course. This is
much like how Lua is doing it, and they also use a very simple lexer
and parser.