24 ms·
That's only if newlines are meaningful in the grammar. In C and related languages they are not, and where they are they tend to be a pain (the dreaded semicolon
by klibertp 10y ago
That's only if newlines are meaningful in the grammar. In C and related languages they are not, and where they are they tend to be a pain (the dreaded semicolon insertion...)
And even if you make newlines meaningful you only trade one pain for another, namely, you now need some kind of line continuation construct and lots of special cases where newlines are allowed...
In short: it's not that simple.
- erikpukinskis 10y agoCan't you just treat newlines like any other delimiter? Granted many tools assume newlines, but you could just not use those tools, or replace newlines with a placeholder so you can parse programs as a single line.