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
0
votes
1 answer

How to include counting of method declaration, constants, functions calls in parser?

I am implementing parser for language similar to java but simpler. I have written a lexer, and am now writing parser. I have written the grammar, I need to implement counting of elements but I have no idea were to put it. I think that it should be…
stacka
  • 11
  • 3
0
votes
3 answers

Matching Lua's "Long bracket" string syntax

I'm writing a jFlex lexer for Lua, and I'm having problems designing a regular expression to match one particular part of the language specification: Literal strings can also be defined using a long format enclosed by long brackets. We define an…
Tyler Levine
  • 383
  • 4
  • 8
-1
votes
1 answer

JFLEX regular expressions for string starts with

I'm new with this jflex and regular expressions I read a lot even though I know I faced the solution in the manual but really I can't understand these regular expressions. I want simple read a text file with jflex and return every line that starts…
Mobinkh
  • 117
  • 1
  • 7
-1
votes
1 answer

Regular expression for email in flex

I am trying to wirte a regular expression for emails in JFlex. So far I tried with this L=[a-zA-Z_]+ D=[0-9]+ email=[^(.+)@(\S+)$] %{ public String lexeme; %} %% {L}({L}|{D})* {lexeme=yytext(); return Identi;} ("(-"{D}+")")|{D}+…
coding2
  • 47
  • 6
-1
votes
1 answer

error recovery in byacc/j and jflex using error token like in yacc

i am writing a compiler for a small language using byacc/j and jflex. i have no problem in finding first error in a given input file. the problem is i cant find more errors. first i used to use yacc and lex and i used special symbol 'error' token at…
am ir
  • 1
-1
votes
1 answer

Object successfully added to a Java ArrayList, but when trying to retrieve that ArrayList, it returns empty list

I am writting a lexer speficications for Jflex, which is supposed to read an input file and return a token. I do successfully complete this part as shown below: /*Super-FORTAN language lexer specification*/ %% %public %class…
-1
votes
1 answer

Patterns in Jflex

My question is Can i use the patterns in the java code ?? I mean if i have this code can i use pdf word in java code i'm looking to use the pattern itself and manipulate it by java so is there any way to do so ? pdf = "."("full.pdf" |…
-1
votes
1 answer

JSON Validation Grammar in Cup and Jflex

I wrote the following cup file for arrays: terminal COMMA, LSQBRACKET, RSQBRACKET; terminal Integer NUMBER; non terminal array, value_list, value; non terminal Integer expr; array ::= LSQBRACKET value_list RSQBRACKET; …
Raushan
  • 7
  • 3
-1
votes
2 answers

Regex for name problem

I need regex for recognizing names which can be [a-zA-Z_] then . (dot) then again [a-zA-Z_]. I ([a-zA-Z_]+) \.([a-zA-Z_]*) but it doesn't work. Help ? Can anybody give me hoe to do that in JFlex ?
JaneNY
  • 65
  • 1
  • 4
-1
votes
1 answer

Cannot run jflex in shell

I have already successfully installed jflex, however when I try to execute a file named "commentaire.flex", I use the command jflex commentaire.flex as what is told in http://jflex.de/manual.html#installing-jflex, but the terminal give back …
Yvonne
  • 21
  • 6
-1
votes
2 answers

Regular Expression for Matching Legal Identifier Names

I'm kinda a newbie to this regular expression thing. I am trying to write a regular expression to match an identifier that follows these rules: It must begin with a letter and can have only letters, digits and underscores. The identifier must also…
-2
votes
1 answer

JFlex - lex structured document

The following image represents code that I need to lex. The document has the following format (in columns term): 1 - 5: comment 6 - 79: actual code 80 - ..: comment If I only had to lex the middle part, there would be no issues at…
LppEdd
  • 20,274
  • 11
  • 84
  • 139
-2
votes
1 answer

Regex for parameters

Could anybody explain me how a regex should look like if I want to match from: section(test) only the string test? Condition is that the string section has to be in front of (test) Thanks for any help
CrustyCheese
  • 49
  • 1
  • 5
-2
votes
2 answers

Javascript to Java regex not working

My regex is as…
alexescg
  • 26
  • 4
-2
votes
1 answer

Regular expression for pos. decimal integr that would be multiple of a number

I am writing as .. lets say we are finding a regexp of 7 then the multiple of 7 in reg exp would be [7|14|21|28] does this seems resonable? please let me know..
user3259486
  • 139
  • 1
  • 1
  • 7
1 2 3
13
14