4 ms·
I first heard about L-Systems a number of years ago in the context of an elective masters course on computer graphics, where we briefly touched on approaches fo
by st_goliath 3y ago
I first heard about L-Systems a number of years ago in the context of an elective masters course on computer graphics, where we briefly touched on approaches for procedural geometry generation.
The way it was introduced to us, was to basically apply a parsing grammar backwards, IIRC using an iterative match-and-generate approach, to produce a command stream for a renderer.
I remember finding the idea of using a parsing grammar in this way quite interesting and wondered about other areas where this could be used. For some reason, programmable shell-completion came to my mind, i.e. encode a command line options for a program using a recursive grammar with "expand a file path here" or "call an external helper (e.g. git)" as terminal symbols. Throw in capture groups for terminals and this kills most use cases where the imperative approach in Bash gets very tedious.
I keep recalling that idea from the back of my mind every time I see L-Systems featured on HN. I guess/hope most newer shells learnt from Bash and already do something like this, but I honestly was just too lazy to investigate this any further (so far).
- choult 3y agoThe way I understand it is applying Chomsky grammar rules (eg. A -> ABF; B -> CFF) but in singular passes rather than expanding to its full length. Eg: Let --- A -> BFC B -> CF+ C -> F- 0. ABC 1. BFCCF+F- 2. CF+FF-F-F+F- 3. F-F+FF-F-F+F- By drawing/considering these iterations you can model cell/biological growth over time; applying the grammar in its whole immediately would only get you to the end result, plus would never end if you had fractal/infinite sequences.