Questions tagged [javacc]

JavaCC - the Java Compiler Compiler - is a popular parser generator and lexical analyzer generator for Java and C++.

JavaCC (Java Compiler Compiler) is an open source parser generator and lexical analyzer generator written in . It produces either or . Both and the parsers generated by have been successfully run on a variety of platforms.

generates top-down parsers. JavaCC can resolve choices based on the next k input tokens, and so can handle LL(k) grammars automatically; by use of "lookahead specifications", it can also resolve choices requiring unbounded look ahead. also generates lexical analyzers in a fashion similar to lex. The tree builder that accompanies it, JJTree, constructs its trees from the bottom up.

is licensed under a BSD license.

Homepage: http://javacc.org/

486 questions
6
votes
3 answers

What's JavaCC's ADVANTAGE versus ANTLR

Too many people have told me about the disadvantages, but what is its advantage if any?
Shinjikun
  • 590
  • 1
  • 5
  • 13
5
votes
4 answers

Explanation and solution for JavaCC's warning "Regular expression choice : FOO can never be matched as : BAR"?

I am teaching myself to use JavaCC in a hobby project, and have a simple grammar to write a parser for. Part of the parser includes the following: TOKEN : { < DIGIT : (["0"-"9"]) > } TOKEN : { < INTEGER : ()+ > } TOKEN : { < INTEGER_PAIR :…
Grundlefleck
  • 124,925
  • 25
  • 94
  • 111
5
votes
1 answer

Korean charset in JJT file

I am trying to add korean character in a JJT file : | < #XCHARSET : ("_latin" | "_unicode" | "_kanjisjis" | "_graphic" | "national" ()+ ("character" | "char")) ()* > | < #XCHARSET2 : ("_latin" |…
hydra123
  • 337
  • 5
  • 14
5
votes
1 answer

Using "~[]" token with lexical states

I'm trying to write a javacc-based parser that involves the following tokens / lexical states: TOKEN : { <"{"> : FIRST } TOKEN : { <"~[]"> : DEFAULT } Trying to parse "{;}" results in the lexical error Encountered: ";" (59),…
5
votes
1 answer

Integrate JavaCC gradle plugin with Android Studio

I have successfully set up a very basic cloud project in android studio following this example. Further, I have added JavaCC support to the project using this gradle plugin. I can now put my *.jj files in the javacc folder and have them compiled by…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
5
votes
8 answers

Tips for speeding up build time on Linux using ANT, Javacc, JUnit and compiling Java classes

We have a large codebase that takes approx 12 minutes on the developer machines to auto-generate some Java 5 classes using JavaCC and then compiles all the classes as well as running the units test. The project consists of multiple projects which…
Craig Angus
  • 22,784
  • 18
  • 55
  • 63
5
votes
4 answers

Is there a version of Javacc that outputs javascript code?

I am looking for a parser generator that accepts a Javacc grammar file (.jj) and generates a parser in Javascript (instead of Java). Does such a thing exist? Alternately how difficult would it be to convert the .jj file to something that ANTLR…
David Tinker
  • 9,383
  • 9
  • 66
  • 98
5
votes
1 answer

Parsing Strings with JavaCC

I'm trying to think of a good way to parse strings using JavaCC without mistakenly matching it to another token. These strings should be able to have spaces, letters, and numbers. My identifier and number token are as follows:
425nesp
  • 6,936
  • 9
  • 50
  • 61
4
votes
1 answer

javacc ignore case locally?

I wish to make part of my JavaCC definitions case insensitive, but not globally. TOKEN [IGNORE_CASE]: { < STRA : "a" > } TOKEN : { < STRB : "b" > } Above seems to make all tokens (STRA AND STRB) case insensitive. How to make only STRB case…
X.M.
  • 941
  • 3
  • 14
  • 22
4
votes
7 answers

Parser, Generator for Java with the following requirements

I am looking for a parser generator for Java that does the following: My language project is pretty simple and only contains a small set of tokens. Output in pure READABLE Java code so that I can modify it (this why I wouldn't use ANTLR) Mature…
Berlin Brown
  • 11,504
  • 37
  • 135
  • 203
4
votes
2 answers

JavaCC lexical error on any type of whitespace

I cleary have the unicode whitespace characters defined in my SKIP token like so: SKIP { " " | "\r" | "\n" | "\t" } However, when I run Java CC it parses all the tokens fine until I hit any of the above mentioning white space characters and it…
kevin sufferdini
  • 131
  • 3
  • 14
4
votes
2 answers

Recognizing extended characters using JAVACC

I'm creating a grammar using JavaCC and have run across a small problem. I'm trying to allow for any valid character within the ASCII extended set to be recognized by the resulting compiler. After looking at the same JavaCC examples (primarily the…
RGordon1982
  • 51
  • 1
  • 4
4
votes
1 answer

Understanding JavaParser compared to JavaCC and Eclipse JDT

I'm currently beginning an automated software analysis project of which I am the research phase. I'm quite new to parsing and struggling to find info on resources regarding comparisons between the main java parsing options. I understand JavaParser…
neversnow1
  • 87
  • 5
4
votes
3 answers

How to setup Javacc in windows 10

How do I install javacc in Windows 10? I visited https://javacc.github.io/javacc/, but there's no clear instruction to set it up on Windows.
cha
  • 131
  • 2
  • 10
4
votes
2 answers

How to match optional open/close tags in JavaCC?

What JavaCC syntax does implement grammar that can parse these kind of lines: [b]content[/b] content[/b] [b]content Although the JavaCC parser needs to parse all lines, it must distinguish correct and incorrect tagging behavior. Correct tags are…
Kdeveloper
  • 13,679
  • 11
  • 41
  • 49
1
2
3
32 33