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 23:23] – [Streamlined Syntax] revuskykey_differences [2021/02/08 18:09] – ↷ Links adapted because of a move operation revusky
Line 21: Line 21:
 JavaCC 21 incorporates an [[new 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.
  
-===== More powerful lookahead ===== +The difference is frequently dramatic. Where the legacy tool required you to write things like:
- +
-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. [[Lookbehind]] predicates allow you to define conditions at [[choice points]] based on scanning backwards in the parse/lookahead stack. [[Lookbehind]] 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 combined effect of the new features is frequently dramatic. Where the legacy tool required you to write things like:+
  
 <code> <code>
Line 40: Line 32:
      Foo Bar =>|| Baz      Foo Bar =>|| Baz
 </code>          </code>         
 +
 +===== More powerful lookahead =====
 +
 +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. 
 +
 +
  
  
 ===== 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 [[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 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!