Feature #210
Updated by Eugen Wissner 6 days ago
It should be possible to declare variables not only at the beginning of a the procedure, but at the beginning of every each block. Each So each block can therefore start begin with the `var` "var" keyword introducing a variable declaration list. Because declarations declaration are not separated by semicolons, an additional separator is needed, that introduces a statement list, that this separator is `begin`. To avoid going back to Pascal, where every Pascal and start each block starts with a `begin`, `begin` is should be optional when a block declares if there are no variables. variable declarations. The consequence of this step is that, also a procedure body can be converted to a such block, so that a procedure that doesn't declare variables can skip `var` and `begin`, same as Oberon does not have them for block-statements. Shadowing remains is still forbidden. The symbol table already supports nested scopes for `for` control variable. The semantic `for`-variables. Semantic passes have to should be extended to enter a scope for every compound statement. `case`-branches count as blocks too. scopes inside all block statements.