I was thinking of grammars for indendation-sensitive languages and it looks like CF grammars would do the trick if combined with parameters. As an example, consider this fragment for simplified Python grammar in ANTLR-like format:
// on top-level the statements have empty indent
program
: statement('')+
;
// let's consider only one compound statement and one simple statement for now
statement(indent)
: ifStatement(indent)
| passStatement(indent)
;
passStatement(indent)
: indent 'pass' NEWLINE
;
// statements under if must have current indent plus 4 spaces
ifStatement(indent)
: indent 'if' expression ':' NEWLINE (statement(indent ' ')+)
;
My question: Does this kind of grammars (CFG with parameters) have a name?
It looks that it wouldn't be hard to write a recursive descent parser for this grammar (parameters should be basically parsers). What could be the difficulties with this approach?
Does addition of parameters raise the supported language class above context-free?