|
|
triple_r wrote:
> All without actually having to write or maintain a parser!
Or you could have a really simple parser, or something that takes XML (or
JSON or some other complex format for which there's already a standard and
parsers), and build up your objects from that. Then your scripts are
programs that output that. Just don't have any loops or variables or whatever.
I mean, it's not really hard to turn something like this into your library
calls:
1 union
2 pigment 1.0 0.0 0.0
3 sphere 0.0 0.0 0.0 2
4 sphere 1.0 0.0 0.0 2
5 sphere 2.0 0.0 0.0 2
...
push 1 3
push 1 4
push 1 5
...
Basically, each call to your library is just the name of the routine
followed by the arguments, and if the line starts with an integer, it's
declaring something to go in that slot, and you refer to the slots later
with numbers. Awful to parse by hand, but trivial to generate in a program,
or even a macro language or scripting language or whatever. Then you don't
have to worry about parsing much, and you can write a different library for
each language like you described that when you're done you say "output this
to a file and feed it to the renderer."
--
Darren New, San Diego CA, USA (PST)
"Ouch ouch ouch!"
"What's wrong? Noodles too hot?"
"No, I have Chopstick Tunnel Syndrome."
Post a reply to this message
|
|