Re: Parsing functions - do I need a keyword like 'def' to indicate a function?

codeworker@free.fr (Cedric LEMAIRE)
17 Oct 2004 16:12:44 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Re: Parsing functions - do I need a keyword like 'def' to indicate a f cdc@maxnet.co.nz (Carl Cerecke) (2004-10-17)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f alexc@TheWorld.com (Alex Colvin) (2004-10-17)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f vbdis@aol.com (2004-10-17)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f cfc@shell01.TheWorld.com (Chris F Clark) (2004-10-17)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f lkrupp@pssw.NOSPAM.com.INVALID (Louis Krupp) (2004-10-17)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f lars@bearnip.com (2004-10-17)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f codeworker@free.fr (2004-10-17)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f zhouhui@wam.umd.edu (Hui Zhou) (2004-10-17)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f postmaster@paul.washington.dc.us (Paul Robinson) (2004-10-21)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f angagon@earthlink.net (Matt O'Connor) (2004-10-30)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f alexc@TheWorld.com (Alex Colvin) (2004-11-02)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f david.thompson1@worldnet.att.net (Dave Thompson) (2004-11-02)
Re: Parsing functions - do I need a keyword like 'def' to indicate a f clint@0lsen.net (Clint Olsen) (2004-11-06)
[3 later articles]
| List of all articles for this month |
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'.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.