From: | codeworker@free.fr (Cedric LEMAIRE) |
Newsgroups: | comp.compilers |
Date: | 17 Oct 2004 16:12:44 -0400 |
Organization: | http://groups.google.com |
References: | 04-10-092 |
Keywords: | syntax, design |
Posted-Date: | 17 Oct 2004 16:12:44 EDT |
"M Cleary" <clearm_ATSYMBOL_comcast_DOT_net@giganews.com> wrote
> ...
>
> The grammar I want to use for my scripting language would
> go something like this:
>
> func_name '(' param_list ')' IS_TOKEN
> func_body
> END_TOKEN
>
> Does anyone have any suggestions as to whether or not I should have/need a
> keyword in front?
It is easier for the parser to resolve at the beginning whether you
are writing a function definition or a function-call expression.
To resolve the ambiguity between:
put_pixel(x, y, color);
and
put_pixel(x, y, color) { ... }
you need to consume characters up to the trailing parenthesis and to
look ahead whether you have a BEGIN_TOKEN or not.
To take it into account, perhaps that your rules will have to be just
a little less 'natural'.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.