Questions tagged [jflex]

JFlex — The Fast Scanner Generator for Java. JFlex is a flex-like lexer generator for Java.

JFlex is a lexical analyzer generator (also known as scanner generator) for Java, written in Java. It is also a rewrite of the very useful tool JLex which was developed by Elliot Berk at Princeton University. As Vern Paxson states for his C/C++ tool flex: They do not share any code though.

JFlex is designed to work together with the LALR parser generator CUP by Scott Hudson, and the Java modification of Berkeley Yacc BYacc/J by Bob Jamison. It can also be used together with other parser generators like ANTLR or as a standalone tool.

Related Links:

196 questions
1
vote
1 answer

Jflex Unexpected Character error

I started studying jflex. When i try to generate output using jflex for the following code I keep getting an error Error in file "\abc.flex" (line 29): Unexpected character [ \t\n]+ ; ^ 1 error, 0 warnings. Generation…
ashish2k3
  • 211
  • 1
  • 2
  • 5
1
vote
1 answer

distinguishing a string with flex

I need to tokenize some strings which will be splitted of according to operators like = and !=. I was successful using regex until the string has != operator. In my case, string was seperated into two parts, which is expected but ! mark is in the…
haluk
  • 1,148
  • 2
  • 9
  • 19
1
vote
2 answers

Special Characters in JFlex Regular Expression

I want to include all special characters in regular expression in JFlex. So I prepared one as below. P = ("_"|"-"|"/"|"."|","|"~"|"!"|"@"|"#"|"$"|"%"|"^"|"&"|"*"|"|"|"("|")"|"="|"+"|"|"|"\"|":"|";"|"""|"<"|">"|"?"|"`"|"{"|"}"|"["|"]"|"'") Could…
Enigma
  • 749
  • 1
  • 13
  • 35
1
vote
1 answer

JFLEX AND CUP, cannot make it work correctly

I'm working with jflex and cup, trying to make a html parser, but can't make it work correctly, Netbeans, the compile process dont stop, always continues, Can't add more "tokens" correctly in the parse tree, Also can't add space in "TEXTO" , this…
Crashman
  • 146
  • 11
1
vote
1 answer

Can't get JFlex output to compile

I have to make a compiler for a subset of C and I decided to use JFlex and Cup. However, when I create my .jflex file, it compiles fine with JFlex, but the output (.java file) will not compile. Directory: src: Lexer.java makefile …
Christophe De Troyer
  • 2,852
  • 3
  • 30
  • 47
1
vote
1 answer

JFlex Compilation Error in JAVA File

I am beginner of JFlex. I am working on Ubuntu and have installed Java as well as JFlex. Both java as well as jflex command are working means PATH variables are set properly. when I run my jflex file, it runs w/o error but while running .java file…
Pratik K. Shah
  • 397
  • 3
  • 17
1
vote
1 answer

IntelliJ Community 12 CE + JFlex

I'm following this tutorial to create a custom language plugin for IntelliJ 12, but I'm running into several issues in regards to the jFlex plugin. When the plugin was installed (via IntelliJ plugin browser) it was configured with the following…
Skyler
  • 341
  • 2
  • 10
1
vote
1 answer

Setting up JCup and JFlex under Eclipse

I need to configure JCup and JFlex under Eclipse somehow. I have found that: http://itee.uq.edu.au/~comp4403/assignments/Eclipse-Setup.html?print=1 and done almost everything but I do lack build-cup.xml andbuild-flex.xml which are necessary later…
Yoda
  • 17,363
  • 67
  • 204
  • 344
1
vote
2 answers

JFlex and CUP compilation error

I have written a simple lexer file from which JFlex has generated a Lexer.java file with no complaints. However I cannot compile the Lexer.java file without the error: package java_cup.runtime does not exist I don't understand what the problem is,…
user2149056
  • 11
  • 1
  • 2
1
vote
2 answers

Java error when running JFlex generated lexer

I have this basic JFlex lexer : import java.util.*; %% %public %class TuringLexer %type Void %init{ yybegin(YYINITIAL); %init} %state COMM, GETALPH, MT, PARSELOOP, PARSELEMS, PARSESYMB, PARSEMT %{ ArrayList alf = new…
pAndrei
  • 383
  • 6
  • 19
1
vote
1 answer

Removing comments with JFlex, but keeping line terminators

I'm writing lexical specification for JFlex (it's like flex, but for Java). I have problem with TraditionalComment (/* */) and DocumentationComment (/** */). So far I have this, taken from JFlex User's Manual: LineTerminator =…
Adam Stelmaszczyk
  • 19,665
  • 4
  • 70
  • 110
1
vote
1 answer

Lookahead assertions (regular expressions) not working in JFlex

I am trying to generate a scanner using JFlex. One of the identifier rules for the grammar I am trying to implement is as follows (in regex syntax): [a-zA-Z]((_(?!_)|[a-zA-Z0-9])*[a-zA-Z0-9])? I have verified that the above expression is actually…
davidadamojr
  • 367
  • 1
  • 2
  • 8
1
vote
1 answer

Compiler Construction for Formal Requirement Specification Language using JFlex and CUP

I am planning to build compiler for Requirement Specification Language. I have come up with idea using JFlex as lexical analyzer and CUP as parser. Can any one let me know it is possible to use JFlex and CUP for formal specification language? All…
man19688
  • 301
  • 1
  • 2
  • 6
0
votes
0 answers

How to generate Actionscript classes from .jflex file?

Is there a way to generate actionscript classes from .jflex file? I know we can generate Java files but I need AS3 classes.
Mady
  • 5,016
  • 7
  • 35
  • 46
0
votes
1 answer

How to set a package name for generated classes when using cup.gradle.cup-gradle-plugin?

The cup arg: -destdir does not work. With or without this option, the generated source files (parser and symbols) always in the top folder (build/generated-src/cup). For example as below, the expected destination folder is…
Zhen
  • 11