Alan Manuel Gloria:
> What I mean is, a general "how to transform this extended BNF to
> actual code".  I'd be more confident of the extensions if we can
> indeed write some code that does this correctly, and can transform our
> BNF into an actual parser.

We're in complete agreement that a spec has to implementable to be useful :-).

Here are my thoughts on implementation:
* SAME/INDENT/etc.: The productions would, just as in the current 
implementation, pass in an extra parameter "indent on start of this 
production", and return the "indent as of the return".  Since the current 
implementation already does this, it's obviously implementable.  Then to 
implement SAME and similar, just call a procedure that takes the two parameters 
(indent-at-start and indent-now) and does a string compare.
* "Preventative productions": In the actual implementation of head, read in an 
n-expression at a time... and yes, actually read in the "prevented" 
productions, because it's hard to stop them.  But the *real* implementation of 
head would return 3 parameters: the list of head entries "so far", the indent, 
and whether or not the reading of head stopped because of a "prevented" 
production (and if so, what it was).

This creates some complications in the implementation of head, but it means 
that the BNF rules get greatly simplified, and there's only one caller of head 
(i-expr), so the complexity is hidden in one place.

--- David A. Wheeler

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to