Skip to main content
8 events
when toggle format what by license comment
May 25, 2019 at 10:56 comment added Michel Billaud Actually, the historical if not typical type of compiler for Pascal is hand made recursive descent parsing.
May 9, 2019 at 21:05 comment added Buffy Actually, I taught compilers for 20 years. I also taught language principles for the same amount of time. There are automated tools for LL parsers also. The "single lookahead" is actually a massive advantage for a human reading a program. It is less important for an automated tool. If you can read a program one token at a time (rather than needing to backtrack) you have a big mental advantage. Again. languages should be LL(1), preferably. Compilers should be efficient.
May 9, 2019 at 21:05 comment added Jon Guiton The left or right factoring affects the feel of the language syntax and most programmers today will be using languages with right factored grammars because the compilers they use will have been constructed using automatic tools which rely on the LR parsing algorithm. I am pointing to this fact to explain why pascal has a "clunky" feel for learners used to right factored grammars having been invented before the LR algorithm was known.
May 9, 2019 at 20:30 comment added Buffy But yes, Pascal is old and has a few flaws. Being LL(1) (mostly) isn't one of them. In fact, a language that has "dangling else" issues isn't LL(1) which is why it requires special rules to match else clauses. It is also why nested if statements often confuse students. It is also why I require students to always fully brace every such "if" and "else" clause. Modula 2 is LL(1) but avoids this issue by requiring "end" for such clauses. But, again. LR is an advantage for compiling efficiency, but NOT - definitely NOT - for understanding.
May 9, 2019 at 20:26 comment added Buffy Sorry, but you have a profound misunderstanding about grammars and especially LL(1). The "int x" convention is no harder to parse with LL(1) than the pascal convention. But if your grammar is not LL(1) it is, in principle, harder for humans to parse than if it is. Most compilers use LR techniques (at least) but that is due to efficiency, not the nature of the language. An LR parser needs to evaluate more of a statement to make a prediction about the meaning than is necessary with an LL(1) language. Don't confuse the structure of the language with the type of compiler typically used.
May 9, 2019 at 20:14 history edited Jon Guiton CC BY-SA 4.0
added 384 characters in body
May 8, 2019 at 21:00 review First posts
May 15, 2019 at 12:21
May 8, 2019 at 20:57 history answered Jon Guiton CC BY-SA 4.0