Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It can be parsed to an AST -- as you note, it can be parsed into two ASTs. It's called an ambiguous grammar, which can still be context free.


> It can be parsed to an AST -- as you note, it can be parsed into two ASTs.

By "it can't be parsed to an AST" I meant "it can't be parsed to a useful AST used to run or generate code" on its own, it needs to be disambiguated through contextual information before anything can be done with the prospective subtree. Sorry for the lack of clarity.

> It's called an ambiguous grammar, which can still be context free.

The only way to disambiguate is to provide expression context (namely visible name bindings at this point), it's essentially the same problem Eli Bendersky described when talking about C grammar's context-sensitivity: http://eli.thegreenplace.net/2007/11/24/the-context-sensitiv...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: