Parsing LDraw


RE: Parsing LDraw
#4
(2025-08-21, 14:35)Peter Blomberg Wrote: The file format is modular, not recursive. Recursive would mean that the same file or callpath contained the same file twice.

The LDraw file format _is_ recursive.  In the same way a tree is a recursive structure.

Or, if you prefer, you could have these LDraw files:
— 0.dat and 1.dat as primitives,
— 2.dat = 0.dat + 1.dat
— 3.dat = 1.dat + 2.dat
— …
— n+1.dat = n-1.dat + n.dat
If that looks familiar, it’s because it’s Fibonacci, the poster child of recursion Wink 

And, as Fibonacci, you can be naive and parse (calculate) the same things twice, or not.  And the structures you need and the way you parse the files don’t only depend on the actions you want to minimize but on the info you need and, therefore, first of all, your purpose.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Parsing LDraw - by Max Murtazin - 2025-08-20, 18:04
RE: Parsing LDraw - by Peter Blomberg - 2025-08-21, 14:35
RE: Parsing LDraw - by Sylvain Sauvage - 2025-08-24, 22:15
RE: Parsing LDraw - by Travis Cobbs - 2025-08-22, 0:33

Forum Jump:


Users browsing this thread: 1 Guest(s)