I have added the new token RATIONAL that recognises rational numbers on my javacc parser. How can I update the output part of the program to print the numeric value of the rational number? For example ('2/5') value =0.4, (8/2') value = 4.0, (4/0') value = infinity, I will be gratefull if anyone could help me thanks.
...
Hi,
I need to build a component which would take a few XML documents in input and check the following kind of rules:
XML1:/bookstore/book[price>35.00] != null
and (XML2:/city/name = 'Montreal'
or XML3://customer[@language] contains 'en')
Basically my component should be able to:
substitute the XML tokens with the correspondin...
Hi Guys, I've been spending some time doing JavaCC parser generation for assignments at University and was wondering if there is a similar simple parser generator framework for .NET available?
I know there is ANTLR, but I found it a bit too big for my taste and really started to like the simplicity that JavaCC brings..
greetings Danie...
Hello, everyone!
I know that there are many examples of JavaCC parsers here,
but they all do nothing. They just accept a string, or produce parsing errors.
What I need is a few examples of real parsers, which actually do something during parsing. (Such as building a DOM tree during parsing an XML string).
Please help! ;)
...
Hello, everyone!
I need to make JavaCC aware of a context (current parent token), and depending on that context, expect different token(s) to occur.
Consider the following pseudo-code:
TOKEN <abc> { "abc*" } // recognizes "abc", "abcd", "abcde", ...
TOKEN <abcd> { "abcd*" } // recognizes "abcd", "abcde", "abcdef", ...
TOKEN <element1...
Hi all,
I am programming (in Java) a very limited symbolic calculus library that manages polynomials, exponentials and expolinomials (sums of elements like "x^n * e^(c x)"). I want the library to be extensible in the sense of new analytic forms (trigonometric, etc.) or new kinds of operations (logarithm, domain transformations, etc.), s...
Hello, everyone!
I know that I can specify the option SUPPORT_CLASS_VISIBILITY_PUBLIC = false; inside a .jj file. But this makes only the generated class itself package-private.
The "boilerplate" classes (such as ParseException) are still public. This is very annoying, since I use java.text.ParseException for public exposure of the API...
Hello, everyone!
I am referring to the XML 1.1 spec.
Look at the definition of NameStartChar:
NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xE...
Hello, everyone!
I had already many problems with understanding, how ambiguous tokens can be handled elegantly (or somehow at all) in JavaCC. Let's take this example:
I want to parse XML processing instruction.
The format is: "<?" <target> <data> "?>": target is an XML name, data can be anything except ?>, because it's the closing tag...
I want to write a parser for EDIFACT messages with JavaCC.
My problem is that I cannot define all terminal symbols before parsing a message because at the begining of each message there is a so called "Advice Segment" ("UNA" Segment) which defines things like element seperator symbol, escape symbol, segment terminator symbol and decimal ...
Hi there, I've used antlr and javacc/freecc for a while.
Now I need to write a bunch of parsers using antlr grammars but such parsers need to be written in ruby lang.
I googled but nothing found. Is there any ruby parser generator that takes antlr grammars and create a parser? If there are many, which is the best one in your opinion?
T...
Hello, i try to compile a java program but in the import section of the code fails:
import java.net.*;
import java.io.*;
import java.util.*;
import java.text.*;
import java.awt.*;
//import java.awt.image.*;
import java.awt.event.*;
//import java.awt.image.renderable.*;
import javax.swing.*;
import javax.swing.border.*;
//import javax.sw...
I'm trying to write a parser in Java for a simple language similar to Latex, i.e. it contains lots of unstructured text with a couple of \commands[with]{some}{parameters} in between. Escape sequences like \\ also have to be taken into account.
I've tried to generate a parser for that with JavaCC, but it looks as if compiler-compilers li...
I do mean the ??? in the title because I'm not exactly sure. Let me explain the situation.
I'm not a computer science student & I never did any compilers course. Till now I used to think that compiler writers or students who did compilers course are outstanding because they had to write Parser component of the compiler in whatever langu...
I'm working on a JavaCC parser that should parse BBcodes.
My Javacc source code: patebin.com (Junit test: here)
The source code kind off works, but it does not want to accept tokens with a single character, only multi character strings are recognized.
It does parse this string:
"test[b]bold[/b]nothing[b]bold[/b]after"
But not:
"t[b...
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 like the 1st line, they have an open and close tag. When the tags are matched this will o...
Hi,
I'm using JavaCC to build a complex parser. At one point, I would like to skip all the character I see until a desired token in my grammar... let's take for example the following
/* bla bla bla bla bla bla bla bla */ => I would like to define a kind of grammar like
<OPEN_COMMENT> SKIP ~[] until <CLOSE_COMMENT> I want it to be t...