POV-Ray : Newsgroups : povray.programming : Parsing a POV-Ray file : Re: Parsing a POV-Ray file Server Time
1 Jun 2024 07:45:20 EDT (-0400)
  Re: Parsing a POV-Ray file  
From: Paul Senzee
Date: 17 Jan 2006 21:13:55
Message: <43cda463$1@news.povray.org>
Hi Oodini,

If you're looking to use flex or bison I'd recommend the o'reilly book
'lex/yacc' by John Levine (I think).  However, given pov's grammar it's
actually quite doable (and probably more maintainable) as a top-down hand
written parser.  Given the pov syntax in BNF it's a mostly straightforward
(although laborious) task to translate that into a C top-down parser.

Either way, for moderate to complex parsing tasks, it's best to divide
parsing into two activities:  lexing and parsing.  Lexing is separating your
input stream of characters into 'tokens'.  A 'token' would be one meaningful
symbol from the input stream, such as any keyword, non-character symbol
(such as '{' or '<'), a string literal, a number, etc.  Parsing is combining
those tokens into some other meaningful form, typically a syntax tree.

Paul Senzee

"Oodini" <svd### [at] freefr> wrote in message
news:432da226$1@news.povray.org...
> Hello,
>
> I programmed a simple 3D renderer in C, and I would like to include a
> parsing functionnality.
>
> I don't know anything about parsing, BNF, flex and other bisons.
> I supposed I am not the first one to do this kind of project. Could
> anyone provide me some links to or advices to get some success with this
> project ?
>
> Ideally: I'd like to have:
>
> 1 - some theory on BNF
> 2 - some examples of grammar, possibly with a scene description language
> 3 - some tutorials with flex or bison
>
> If you have any other material to provide, you're welcome. :-)


Post a reply to this message

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