On adding indents to an LALR(1) parser. Two ideas. 1/ end-of-line should sometimes be a semantic end-of-statement. But when? 2/ line continuation by indent is easy to read: this a semantic unit which has been broken on to multiple lines but clearly is all one unit this is a new unit We could suggest that whenever something is indented it doesn't end the statement, but that doesn't allow for nexting if stuff { thing 1 thing 2 } thing 3 Thing1 is indented but should be terminated. Only locally though, the 'if' shouldn't be terminated. a = [ one, two, there, four, ] b = 5 pattern of indents is identical here, but now several newlines should be ignored. why is this so? Mostly because lists are declared as being terminated by newlines. More examples? First we need help from the lexer/scanner. It must report newlines, indents, and undents (or outdents or dedents or whatever). If a line in more indented than the previous line, we get an 'indent'. If a line is less indented, then we get one or more undents. Possibly we can get undents and indents all at once. line1 line2 line3 line4 line5 Line 2 has an indent, line3 another indent. line 4 get an undent so it lines up with line 2. line 5 needs an undent, but that would imply it lines up with line 1 which it doesn't. So it needs and undent and an indent. We get the lexer to produce these and the newlines, but it does something clever with newlines. An 'indent' is never accompanied by a newline. Instead the newline is delayed until after the matching undent. So the above would be scanned as line1 indent line2 indent line3 newline undent newline line4 newline undent newline indent line5 undent newline If we then choose to ignore a particular indent and all newlines, indents and undents until the matching undent, then we will still see a newline at the end and it indented section will look like line continuation. How do we choose what to ignore?