rfc:ast_based_parsing_compilation_process

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:ast_based_parsing_compilation_process [2012/09/07 13:15] nikicrfc:ast_based_parsing_compilation_process [2012/09/07 13:23] – Add section on error messages nikic
Line 47: Line 47:
   * List comprehensions / generator expressions where the result expression comes first, e.g. ''[x * x for x in list]'' in Python. In PHP only the reverse syntax is possible: ''[foreach ($list as $x) yield $x * $x]''   * List comprehensions / generator expressions where the result expression comes first, e.g. ''[x * x for x in list]'' in Python. In PHP only the reverse syntax is possible: ''[foreach ($list as $x) yield $x * $x]''
  
-Apart from larger syntax limitations the current system commonly also affects smaller syntax decisions.+Apart from larger syntax limitations the current system commonly also affects smaller syntax decisions. One example here are the strange parentheses requirements for the ''yield'' expression. Those requirements exist solely for technical reasons and would not be required with an AST-generating parser. 
 + 
 +==== Better error messages ==== 
 + 
 +Currently many things are directly enforced in the grammar which should really be checked during compilation (or a completely separate pass). E.g. if you try to initialize a class property with a non-static value, you'll get a rather unintelligible parse error message, instead of something like ''Cannot initialize property with non-static value''. (And then you obviously go to StackOverflow, ask the question for the five hundredth time and annoy the heck out of me!)
  
 ===== Disadvantages ===== ===== Disadvantages =====
rfc/ast_based_parsing_compilation_process.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1