POV-Ray : Newsgroups : povray.general : New SDL: support for lexical scanner generators : Re: New SDL: support for lexical scanner generators Server Time
31 Jul 2024 06:15:33 EDT (-0400)
  Re: New SDL: support for lexical scanner generators  
From: Wolf
Date: 4 Oct 2007 16:55:01
Message: <web.4705522c84df9986edd244720@news.povray.org>
"Bruno Cabasson" <bru### [at] alcatelaleniaspacefr> wrote:

> Right. Perhaps its is a chance for us that the new grammar is intended to be
> simple (which does not mean 'limited'). However, if it appears that
> ready-made lexical scanner generators are not OK for our purpose, writing a
> hand-made one will not be very difficult to specialists. I hope ....

Well, if the new SDL has a grammar which is not representable by a
general-purpose lexical scanner generator like ANTLR there should be a
quite good reason to do so. Why would you want to write a complete scanner
generator if you get one for free by using open source products?

You have to implement the parsing rules anyway. If you implement them by
hand you will probably end up producing spaghetti code containing lot of
"IF" statements.
By writing a grammar specification and using a scanner generator you get
much cleaner entry points to parts of the grammar (high-level ones like
textures as well as low-level ones like vectors).


Maybe a hand-written scanner is faster than a generated one, but speed
considerations should not be overweighted here as the parsing time is
negligible  compared to the rendering time.

- Wolf


Post a reply to this message

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