POV-Ray : Newsgroups : povray.general : Attempt to POV4 Syntax basics : Re: Attempt to POV4 Syntax basics Server Time
31 Jul 2024 12:25:01 EDT (-0400)
  Re: Attempt to POV4 Syntax basics  
From: David Buck
Date: 9 Oct 2007 21:03:56
Message: <470c24fc$1@news.povray.org>
Bruno Cabasson wrote:
> Hello David. Glad to see you.
> 
> I am not a compiler writer, but, correct me if I am on the wrong way (it's
> sooo long ago), my memory reminds me that this is what happens naturally
> when you write syntax-directed parser for LL(1) grammars.

This does indeed implement an LL grammar but the semantics don't happen 
completely naturally.  There's a little bit of magic under the covers.

My point, I suppose, is to say "stay away from a large formal grammar - 
model it with a simple grammar supported by an extendable mechanism"

> What you propose
> seems to me like an uniformization of the grammar by means of something
> like
> 
> block
> {
>     property_name <value>
>     another_block {.... } // cannot be any block. Must be a compatible block
> like 'pigment' in objects
>     <method_name> <parameter_list> // e.g. scale/rotate/translate
> }
> 
> The stack you mention is simply the call-stack of the parser (let me have a
> look at my compiler courses, poor me :o().
> 
> Bruno

Yes, the stack is similar to a call-stack used by an LL parser.  The 
stack is needed to know which object to sent the messages to.  Since you 
can have {} braces within other {} braces, you need a stack to manage 
the nesting.

David Buck


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.