On 29 April 2010 12:39, Jonas Maebe <jonas.ma...@elis.ugent.be> wrote:
>
> The compiler uses only a single lookahead token, while disambiguating your
> example would require two.

I did look at the links you posted and still couldn't see the problem.
The paragraph above gives the key information -  the FPC parses only
uses a single lookahead.

This still seems rather trivial to fix - resulting in a bit more sane
syntax. Simply keep an extra backpointer, so that when the compiler
finally knows what 'default' (wiki example) or 'deprecated' (my
example) relates to, that it can still apply the hint directive by
using the backpointer.  Or (like I have seen in many pascal parsers
before), allow for more than one lookahead. I have frequently seen
object pascal parsers allow for 3 lookaheads (parser available in
PSP/PWU web framework does this).

It seems rather silly to limit the syntax (wiki example) or force a
rather weird inconsistent syntax (my example) on the developers when
the parser could easily be fixed.

More examples:
fpdoc often uses back pointers to write LaTeX or IPF output. Also, it
would imagine the parsing would be pretty similar to what FPC already
does with:  ....; virtual; abstract;
After the method declaration, it has to keep track of that so it can
apply 'virtual', and then again 'abstract' to it.

Out of interest, I am looking at the fcl-passrc to see if I can modify
it to work with my suggested syntax. I don't know the code at all, so
it might take longer than normal. But it should show it is quite
possible.

-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to