Difference between SLL and LL

499 views
Skip to first unread message

newbieParser

unread,
Oct 18, 2021, 3:23:11 AM10/18/21
to antlr-discussion
Hi
So I am having a hard time understanding the difference between LL and SLL parsing.
I have read the documentation but still not able to understand the difference.

For SLL it is written that, 
"When using this prediction mode, the parser will either return a correct parse tree (i.e. the same parse tree that would be returned with the LL prediction mode), or it will report a syntax error. If a syntax error is encountered when using the SLL prediction mode, it may be due to either an actual syntax error in the input or indicate that the particular combination of grammar and input requires the more powerful LL prediction abilities to complete successfully."

While for LL,
"When using this prediction mode, the parser will make correct decisions for all syntactically-correct grammar and input combinations. However, in cases where the grammar is truly ambiguous this prediction mode might not report a precise answer for exactly which alternatives are ambiguous."


Since it is written that SLL will either give correct parse tree same as LL or throw a syntax error either due actual error which will be thencase in LL also or "due combination of grammar and input requires the more powerful LL prediction abilities to complete successfully."

I am having specific difficulty in understanding the last line, I have used SLL for hundereds of input files for a particular grammar but not once encountered any error. When will SLL fail due to the latter condition?
Reply all
Reply to author
Forward
0 new messages