Re: Re: EBNF

From: Date: Sun, 02 Jan 2011 22:21:54 +0000
Subject: Re: Re: EBNF
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-51186@lists.php.net to get a copy of this message
>> Nonetheless, it's a significant undertaking to deal with the complexity of the >> language. There are dozens of tiny little edge cases in PHP's parsing that require bunches of >> extra parser rules. An example from above is the difference between using "statement" and >> "inner-statement" for the two different forms of "if". Because >> "statement" includes basic blocks and labels, the rule disallows writing "if: { xyz; >> } endif;", since apparently Zend doesn't support arbitrary basic blocks. All those cases >> wreak havoc on the grammar. In its present form, it will never reduce down to something nearly as >> small as Python's. > > Just to have a solid, complete maintained EBNF would be a _major_ leap forward! > Having an EBNF would be useful in cases where we want to write something like Ruby's CoffeeScript. After looking at PHP's grammar file, it's about 1,000 lines long. Since this is used to generate the parser, isn't it possible to strip out the C macros to create an EBNF that catches all edge cases? Jon

« previous php.internals (#51186) next »