Rather basic coco question

Jon Shemitz <jon@midnightbeach.com>
30 Jan 2003 00:04:29 -0500

          From comp.compilers

Related articles
Rather basic coco question jon@midnightbeach.com (Jon Shemitz) (2003-01-30)
| List of all articles for this month |

From: Jon Shemitz <jon@midnightbeach.com>
Newsgroups: comp.compilers
Date: 30 Jan 2003 00:04:29 -0500
Organization: Midnight Beach
Keywords: tools, question
Posted-Date: 30 Jan 2003 00:04:29 EST

I'm writing a simple script compiler for a web-site management system.
Each <script> block contains a series of functions, and only
functions, which may be either "public" or "private". Public fns can
be called while converting the site source to 'object HTML code';
private fns can only be from functions within the <script> block
scope.


I'm using coco for various reasons. Here's an short,
attribute-stripped excerpt from my .atg file - top-level production is
"Ethiopia":


Ethiopia = { SYNC Function }.


Function = SYNC Prototype
SYNC CompoundStatement.


Prototype = SYNC Visibility
SYNC ResultType
SYNC FunctionName
SYNC "("
[ParameterList]
SYNC ")".


Visibility = SYNC "public" |
[ SYNC "private"].


This mostly works, picking up multiple functions, handling defaulted
visibility properly, and detecting syntax errors in the ResultType,
FunctionName, and ParameterList. If, however, a function starts with
an invalid visibility like


bogus string BreakIt(string Foo) {}


the parser proceeds to ignore everything until EOF. I'm afraid I don't
know what might be wrong, here - though I've tried lots of
permutations, and know it's not the "Visibility deletable" that I get
because the "private" keyword is optional.


--


Consulting & contract programming http://www.midnightbeach.com
My Kylix book http://www.midnightbeach.com/kylix
Homeschool resources http://www.midnightbeach.com/hs


Post a followup to this message

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