Related articles |
---|
Parsing functions - do I need a keyword like 'def' to indicate a funct clearm_ATSYMBOL_comcast_DOT_net@giganews.com (M Cleary) (2004-10-12) |
Re: Parsing functions - do I need a keyword like 'def' to indicate a f awwaiid@thelackthereof.org (Brock) (2004-10-17) |
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) |
[11 later articles] |
From: | "M Cleary" <clearm_ATSYMBOL_comcast_DOT_net@giganews.com> |
Newsgroups: | comp.compilers |
Date: | 12 Oct 2004 00:53:10 -0400 |
Organization: | Compilers Central |
Keywords: | syntax, design, question |
Posted-Date: | 12 Oct 2004 00:53:09 EDT |
I'm trying to create a simple scripting language using lex and yacc. I've
noticed that the grammars for most scripting languages have some kind of
keyword in front of function declarations. For example:
ruby and python use "def"
perl uses "sub"
lua uses "function"
tcl uses "proc"
for example in python you use: def setColor (r, g, b):
I was wondering why that is. I suspect the point is to avoid of ambiguity
with other language constructs, but I'm not sure. If possible, I don't want
to use a keyword. 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?
Thanks,
Matt C.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.