- Preprocessor
- Count whitespace at start of each line
- Transform into {} and ; based blocks
- Pass to ANTLR grammar
- Profit
html | |
body | |
h1 Hello | |
p Foo |
html { body { h1 Hello {} p Foo {} } } |
grammar Grammar; | |
WS: [ \n\r\t] -> skip; | |
ID: [A-Za-z_] [A-Za-z0-9_]*; | |
compilationUnit: block*; | |
block: name=ID '{' (stmt ';'*)* '}'; | |
stmt: | |
block #BlockStmt | |
; |