Hello Tomas, Am 16.06.2020 um 09:36 schrieb Tomas Kral:
Read a bit on `Compiler construction', formalism and context free allows for simple compiler coding from EBNF.
Oberon-07 has a few exceptions to free context, if I got the idea right?
From my head, I cannot think of a case why Oberon is not LL(k), but
I believe that Oberon-07 (at least the EBNF in the book) can be parsed with a context-free parser, and I think the actual ORP implementation is even LL(k) [or even LL(1)?] In general, Oberon-07 is not LL(1), since I can think of at least one case where the parse tree cannot be constructed without a larger lookahead: While parsing a type guard a(B).c when parser is at the "B" (which can even be M.B when qualified by a module), the parser can not yet tell whether "a" is a procedure variable and "B" is its argument or "a" is a record variable and "B" is a type. With a finite lookahead the compiler can see the "." and therefore disambiguate the situation. ORP does not have the problem as it will check the type of "a" during parsing, and if it is a record type or pointer type it can be parsed as a type guard: https://schierlm.github.io/OberonXref/ProjectOberon2013/ORP.html#L_150 probably somebody else has a good example. Regards, Michael