4 ms·
I had no idea what lexing and parsing was when I wrote my first compiler so I tried writing both of these processes in the same module. It was so hard that I na
by baby 4y ago
I had no idea what lexing and parsing was when I wrote my first compiler so I tried writing both of these processes in the same module. It was so hard that I naturally split the lexing part of things in a first pass, then realized that it had a name and that it was what everyone was doing. So the simple answer is that it’s the natural way of doing things.
- magicalhippo 4y agoI mean, this is how we write programs usually ain't it? We break the problem up into chunks, composing functions and/or objects on our way to the solution. In this case there's a fairly natural split, as you mention, so it's natural to use composition to handle this as well.