Questions tagged [cup]

CUP is a parser generator for Java.

CUP generates Look-Ahead Left Recursive parser in Java.

It is related to two other projects:

  • is a scanner generator which can rely on CUP
  • Classgen is a tool to generate class frameworks and visitor patterns
76 questions
0
votes
0 answers

java_cup.runtime.Symbol "EOF" has not been declared

I have alreay read this discussion, but it didn't help me. start with file; file ::= primario SEP secondario SEP terziario EOF {:fm.scriviDebug();:}; Where fm.scriviDebug() is a my custom class that prints on stdout what CUP parsed. I have no idea…
shogitai
  • 1,823
  • 1
  • 23
  • 50
0
votes
2 answers

Can't run jflex.bat in windows 8.1

I just made the installation of jflex and cup and I want to test if everything is ok. Here is what I write in the shell and the result I get. Here is the content of jflex.bat file: Is there something I have done wrong? How to run for first time…
John Dow
  • 47
  • 2
  • 7
0
votes
1 answer

I am getting a Shift/Reduce conflict with CUP

I have the following parse code, but I am getting a shift/reduce conflict between the non terminals expression and function_call. This is a small parse code for the Visual Basic programming language. Could the CFG be wrong? Or Is the problem in only…
0
votes
1 answer

Parsing shift-reduce conflict

I am using JavaCUP tool in order to produce a parser for my language. I am trying to write a grammar that matches nested and multiple if_else statements. Input file // matches if () if () else if () else else // no match ->…
pirox22
  • 892
  • 1
  • 14
  • 30
0
votes
1 answer

How to get rid of reduce/reduce, reduce/shift errors?

I keep on running into reduce/reduce and reduce/shift problems with my grammar, but I'm not sure why or how to fix it. Here is what I have block ::= block_statement | block_statement block ; block_statement ::= type…
Paul
  • 121
  • 1
  • 1
  • 4
0
votes
0 answers

haskell grammar for cup file

i am working on a haskell compiler written in java using JLex and cup .i finished my lexer file and now i am working on my parser.cup file where i should define my terminals , non-terminals and the grammar. i have already finished the terminal and…
Halawa
  • 1,171
  • 2
  • 9
  • 19
0
votes
1 answer

Linking CUP and jflex

I am trying to link my parser.java and yylex.java using help from http://www2.cs.tum.edu/projects/cup/examples.php http://www.cs.princeton.edu/~appel/modern/java/CUP/manual.html http://jflex.de/manual.html But I am getting these errors. error:…
uutsav
  • 389
  • 5
  • 16
0
votes
1 answer

Java Cup install Windows

So I've been having some trouble regarding installing Cup in a windows 7 environment. I've been following this guide mainly. The problem I come across is when I try to run cup on a file(.cup) I get the familiar "'cup' is not recognized as an…
Andro
  • 13
  • 6
0
votes
3 answers

Java CUP and JFlex Interaction

I am considering to use the CUP parser generator for a project. In order to correctly parse some constructs of the language I am going to be compiling, I will need the lexer (generated by JFlex) to use information from the symbol table (not parse…
0
votes
0 answers

how to compile the java file generated by cup

I downloaded the demo from http://www2.cs.tum.edu/projects/cup/ I got parser.java by command: java -jar bin/java-cup-11a.jar cup/parser.cup but when I compile parser.java by: javac -classpath lib/java-cup-11a-runtime.jar parser.java the result…
cspro
  • 1
  • 1
0
votes
2 answers

Arithmetic expression grammar in prefix notation (Java Cup)

I'm writting a grammar for arithmetic expression in prefix notation. However I have an issue when parsing negative numbers or substraction. Grammar example is this: precedence right +, -; precedence right *, /; precedence right uminus; E ::= + E E …
0
votes
1 answer

shift/reduce conflict in cup parser (grammar with arrarys and matrices)

I am writing a cup parser for a small language that is supposed to support classes with arrays and matrices as its fields. For example, if there is a class instance: C c; the fields are to be accessed with: c.x; c.y[]; c.z[][]; I am having trouble…
0
votes
0 answers

Cannot find symbol error in the generated class file

I am designing a compiler for a small programming language. We are given a java pre processor (GEN package) which generates the ASTs needed for the compilers. We have to just give the input grammar in a specific format to the GEN file. The GEN file…
Ramesh
  • 765
  • 7
  • 24
  • 52
0
votes
1 answer

How to define at least one occurrence of a string between two tokens in a CUP parser grammar

I am trying to define a non terminal symbol in a LALR(1) grammar (with CUP parser). It is requested that the token must appear exactly two times, while token must appear at least one time. In the end I came up with this…
gc5
  • 9,468
  • 24
  • 90
  • 151
-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