On Feb 23, 1:45 pm, Ivan Andrus <darthand...@gmail.com> wrote:


>
> > (RJF) I know of no other programming language that requires this.
>
> C++0x will require something similar for templates, so that
>
> std::vector<SomeType<bool>> x;
>
> will parse instead of requiring
>
> std::vector<SomeType<bool> > x;
>
> That said, I don't think many people consider C++ to be an easy language to 
> parse. :-)
>
> -Ivan

that looks similarly nasty.

This semanticdesigns company is using a "GLR" parser, which is fairly
general but
potentially slow if the grammar in use is more ambiguous than not.

I suppose there is another way around this in Mathematica, which is to
not recognize [[ or ]]
as tokens, but only [ and ].  And some investigation shows this is
what they do.
let L={a,b,c,d}    a list of 4 elements
L[[2]]   evaluates to the 2nd element, namely b.
L[ [ 2 ] ]  evaluates to b  as well.

There are other 2- or 3- character tokens, such as ==, and ===.  The
question
naturally occurs as to whether you can put spaces in the middle of
those too.

A==B   tests to see if A is equal to B
A= =B  is syntactically incorrect.

Probably a C++ parser would use the same trick and not have a token >>
at all.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to