POV-Ray : Newsgroups : povray.general : Attempt to POV4 Syntax basics : Re: Attempt to POV4 Syntax basics Server Time
31 Jul 2024 12:14:41 EDT (-0400)
  Re: Attempt to POV4 Syntax basics  
From: Bruno Cabasson
Date: 9 Oct 2007 10:10:00
Message: <web.470b8ac3153c00f6e8ba46670@news.povray.org>
David Buck <dav### [at] simberoncom> wrote:
> Warp wrote:
> > Fa3ien <fab### [at] yourshoesskynetbe> wrote:
> >> POV-Ray allows you to do that, not as a side-effect of the SDL, but
> >> precisely BY DESIGN.  Drop that, and you kill POV-Ray (there are
> >> already many nice and free pure renderers out there).
> >
> > Thus all you who are worrying about the "new SDL" being some cryptic
> > high-end programming language only a few can understand, you have got
> > it completely wrong: Keeping the current ease-of-use and, as far as
> > possible, the same syntax, is a *major* concern in the designing of
> > the new SDL. You don't have to express your concern about this.
> >
> >   (Of course a different issue is whether there's enough manpower and
> > expertise to actually develop and implement such a language.)
> >
>
> When I have a few minutes here and there, I'm working on a technique
> which retains the current SDL (with the possible exception of macros as
> they currently exist) but makes it user-expandable.  The POV SDL syntax
> doesn't need to be the huge complex thing that it appears to be.  For
> example, consider the following snippet of SDL:
>
> camera {
>     location <-5, 10, -15>
>     direction <0, 0,  2.25>
>     right x*1.33
>     look_at <0,0,0>
> }
>
> sky_sphere {
>      pigment {
>          gradient y
>          color_map {
>              [0, 1  color Gray50 color Gray80]
>          }
>      }
> }
>
> The parts of the syntax would include things like 1.33, <-5, 10, -15>,
> {} and []. The rest of the identifiers name methods written in either
> the SDL itself or a high level programming language.
>
> The semantics would be something like:
>
> camera
>  - call the camera method to:
>   - create an instance of a camera
>   - add it to the scene
> {
>  - push it on the stack
>
> location
>  - call the location method to:
>   - expect a vector parameter to follow
>   - apply to the top of stack (the camera)
>
> }
>  - pop the stack
>
>
> sky_sphere
>  - call the sky_sphere method to:
>   - create a sky_sphere
>   - add it to the scene
> {
>  - push it on the stack
>
> pigment
>  - call the pigment method to:
>   - create a new pigment
>   - apply it to the sky sphere
> {
>  - push the pigment on the stack
>
> etc...
>
> The words like camera, location, pigment, and so forth are no longer
> part of the syntax - they are methods that are called by the parser.  To
> add new functionality, you can add new methods which can be written in
> either SDL or the high level programming language.
>
> It seems to me like the whole SDL grammar can be modelled this way which
> would give backwards compatibility as well as expandability.
>
>
> Thoughts?
>
> David Buck

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. 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


Post a reply to this message

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