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
0 answers

adding environment variables does not work for JFLEX windows 10

So, I watched a few YouTube videos and read a few Stack overflow answers, and here is what I've done so far for paths in the environment…
Elena Asi
  • 39
  • 7
0
votes
0 answers

How to save a symbol value in CUP? java parser

I'm using CUP for a project but I'm not really sure how to save the value of the token TEXT into a String here´s my production: error_content ::= LEXEMA_START TEXT LEXEMA_END {: System.out.println("´text value" ); :} | LINE_START…
Ale
  • 3
  • 2
0
votes
1 answer

How can I use JFlex if i´m cloning a project from github

i'm currently working on a Lexer in Java, i'm using jflex to do this, when my partner runs the code it works, he pushed it into a repo in github. I cloned it and when trying to run it, it says it cannot find a symbol which is Lexer, this is a class…
0
votes
0 answers

generateLexer/generateParser gradle tasks problem in intellij idea plugin build

I try to extend some old IntelliJ plug-in And there is my build.gradle buildscript { ext.kotlin_version = '1.6.0' repositories { mavenCentral() maven { url 'https://jitpack.io'} maven { url…
0
votes
0 answers

Unexpected character JFLEX

Hello i was watching a tutorial on youtube. It was the start of tutorial but when i tried to wrote the code and run this flex.l file. The output show unexpected character [a-z] {printf("Single lowercase character\n");} . What should i do with this…
0
votes
1 answer

Jflex ambiguity

I have these two rules from a jflex code: Bool = true Ident = [:letter:][:letterdigit:]* if I try for example to analyse the word "trueStat", it gets recognnized as an Ident expression and not Bool. How can I avoid this type of ambiguity in Jflex?
user14373483
0
votes
0 answers

Why does my $1 operation not work with Java Bison?

When I have an abstract syntax tree in the Java Bison (.y) file with this: string_op: SYMBOL_PLUS { $$ = $1; System.out.println("this should print + here: " + $$);} | SYMBOL_DOUBLEEQ | SYMBOL_NOTEQ; I would expect it to print "this should…
izash
  • 51
  • 5
0
votes
1 answer

Java Bison and Jflex error for redeclared/undeclared variables

I am making a compiler with Jflex and Bison. Jflex does the lexical analysis. Bison does the parsing. The lexical analysis (in a .l file) is perfect. Tokenizes the input, and passes the input to the .y file for Bison to parse. I need the parser to…
Chronicle
  • 11
  • 2
0
votes
1 answer

How to use Jflex and Bison Together?

I am really struggling to use Jflex and Bison together. For example, here's some sample code: https://github.com/valecor95/bison-flex-jflex-examples/tree/master/Java/1_BalancedParentheses/BalPar1 You run make: It just makes a load of files, and…
izash
  • 51
  • 5
0
votes
0 answers

Parsing grammar error with JCup and JFlex when run parser

Continuing with the example that I am doing with JCup and JFlex Error when run parsing using cup and jflex, I am getting an error when parsing the following statement. Label(name="Label1", title="Label title"); I don't understand the reason for…
Marco Osorio
  • 101
  • 8
0
votes
1 answer

Jflex and CUP not working on vscode and mac

I downloaded jflex by doing brew install jflex everything worked the way it should. But now when I'm trying to make it work with java_cup.runtime.*. And I keep getting the errors below Lexer.java:681: error: cannot find symbol { return new…
carlosdafield
  • 1,479
  • 5
  • 16
0
votes
1 answer

Jflex Regular expression for string with escaped characters

I am generating lexical analyzer with JFLEX. I need to find all strings which containing escaped characters using regular expressions. I'm struggling with this. What could it be?
izash
  • 51
  • 5
0
votes
1 answer

Error when run parsing using cup and jflex

I am new to JFlex and CUP. I am trying to do a simple example, but when I run the parser, it always gives the same error, it does not progress with the recognition of the statements. I think the problem must be in the productions or rules. I have…
Marco Osorio
  • 101
  • 8
0
votes
1 answer

check if condition is met before executing the action in JFlex

I am writing a lexical analyzer using JFlex. When the word co is matched, we have to ignore what comes after until the end of the line (because it's a comment). For the moment, I have a boolean variable that changes to true whenever this word is…
mrjamaisvu
  • 137
  • 9
0
votes
1 answer

Explanation of JFlex Block Comment rule

I was looking on how to implement block comments in JFlex for custom language support in intellij and found that it can be described as "/*" !([^]* "*/" [^]*) ("*/")? I don't quite understand how to read this and would like it if it were explained…