Semicolon free grammar



There is no need to use semicolons in 11l to terminate statements {}. Statements are always terminated by a newline character if there is no implied line joining occured (see below).


Implied line joining



Instead of clumsy things like Automatic Semicolon Insertion with overly complex rules (which also sometimes works incorrectly {}) 11l uses in general just 3 simple rules, which are both easy to understand for a human and to implement in a lexical analyser:
  1. Every line of code which ends with any binary operator will be joined with the following/next line of code:
    I condition1 | // this line will be joined with the following/next line because it ends with a binary operator `|`
      condition2
       some_func()
    
  2. Every line of code which begins with any binary operator will be joined with the previous line of code:
    some_variable = 2
                  + 3 // this line will be joined with the previous line because it begins with a binary operator `+`
    
  3. And like in Python expressions in parentheses and square brackets can be split over more than one physical line:
    some_func( // because there is an unclosed parenthesis all following lines will be joined with this one
       argument1,                                                            \\ until parenthesis is closed
       argument2)