meta data for this page
  •  

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
key_differences [2020/09/26 22:47] – [Code Injection] revuskykey_differences [2021/02/08 18:09] – ↷ Links adapted because of a move operation revusky
Line 19: Line 19:
 ===== Streamlined Syntax ===== ===== Streamlined Syntax =====
  
-JavaCC 21 incorporates an [[streamlined syntax summary|alternative streamlined syntax]] that should be quite a bit more pleasant to write and easier to read.+JavaCC 21 incorporates an [[new syntax summary|alternative streamlined syntax]] that should be quite a bit more pleasant to write and easier to read. 
 + 
 +The difference is frequently dramatic. Where the legacy tool required you to write things like: 
 + 
 +<code> 
 +    LOOKAHEAD (Foo() Bar()) Foo() Bar() Baz() 
 +</code> 
 + 
 +in JavaCC 21 you could express the above as: 
 + 
 +<code> 
 +     Foo Bar =>|| Baz 
 +</code>         
  
 ===== More powerful lookahead ===== ===== More powerful lookahead =====
  
-The ''SCAN'' construct (designed to supersede the legacy ''LOOKAHEAD'') offers a superset of the legacy ''LOOKAHEAD'' functionality. [[Lookbehind]] predicates allow you to define conditions at [[choice points]] based on scanning backwards in the parse/lookahead stack.+Perhaps most importantly, the longstanding bug of nested syntactic lookahead not working correctly has [[https://javacc.com/2020/07/15/nested-syntactic-lookahead-works/|finally been squashed]]! 
 + 
 +The ''SCAN'' construct (designed to supersede the legacy ''LOOKAHEAD'') offers a superset of the legacy ''LOOKAHEAD'' functionality. [[contextual_predicates]] predicates allow you to define conditions at [[choice points]] based on scanning backwards in the parse/lookahead stack. [[contextual_predicates]] also works in arbitrarily nested scanahead. 
 + 
 +The new [[up to here]] construct should eliminate the need to write more verbose and error-prone numerical and syntactic lookahead constructs.  
  
-The new [[up to here]] construct should eliminate the need to write more verbose and error-prone numerical and syntactic lookahead constructs. 
  
-The longstanding bug of nested syntactic lookahead not working correctly has [[https://javacc.com/2020/07/15/nested-syntactic-lookahead-works/|finally been squashed]]! 
  
 ===== JavaCC 21 is being actively developed ===== ===== JavaCC 21 is being actively developed =====
  
-JavaCC 21 now supports the full Java language up through Java 13. Since the [[Java.javacc|https://github.com/javacc21/javacc21/blob/master/src/main/grammars/Java.javacc]] is embedded in [[JavaCC.javacc|https://github.com/javacc21/javacc21/blob/master/src/main/grammars/JavaCC.javacc#L341]] using the new [[INCLUDE]] mechanism, that Java grammar is usable on its own. Note that this grammar successfully parses all the Java source code in the OpenJDK 13, as well as all the Java source code in JRuby, Jython, and FreeMarker. So, if anybody needs a Java code parser for use in their own projects, this is quite usable! +JavaCC 21 now supports the full Java language up through Java 15. Since the [[https://github.com/javacc21/javacc21/blob/master/src/main/grammars/Java.javacc|Java grammar]] is embedded in [[https://github.com/javacc21/javacc21/blob/master/src/main/grammars/JavaCC.javacc#L413|JavaCC grammar]] using the [[INCLUDE]] mechanism, that Java grammar is usable on its own. Note that this grammar successfully parses all the Java source code in the OpenJDK 15, as well as all the Java source code in JRuby, Jython, and FreeMarker. So, if anybody needs a Java code parser for use in their own projects, this is quite usable!