2 ms·
Pascal can undoubtedly be shoehorned into the target of a simple, single-pass LL(1) parser. Doing so comes at a real "flexibility" cost, though. For example, do
by neokantian 8y ago
Pascal can undoubtedly be shoehorned into the target of a simple, single-pass LL(1) parser. Doing so comes at a real "flexibility" cost, though. For example, don't try to define your functions in any arbitrary order. It won't fly. As a programmer, you will surely notice the limitations of single-pass LL(1) compilers. Nowadays, infix/Eulerian notations are generally targeted with at least an LALR(1) parser. The notational complexity in languages like C++ (in gcc) and C# generally even exceed what LALR(1) can handle. Apparently, their parsers need to be painstakingly hand-coded. In my book, that is clearly overshoot. Do we really need to create a dependency on languages that even LALR(1) cannot handle? What are you even getting in exchange? Debatable ...
- deleted 8y ago[deleted]
- WalterBright 8y agoThose are all valid points, but not relevant to infix vs prefix notation. I don't know about C#, but parsing C++ is complex because you need a symbol table to do it. D doesn't need a symbol table to parse, but it does require arbitrary lookahead. It still isn't hard to parse, and the parser fits in one file: https://github.com/dlang/dmd/blob/master/src/dmd/parse.d https://github.com/dlang/dmd/blob/master/src/dmd/parse.d