javacc

JavaCC: You must either use ReInit() or set the JavaCC option STATIC to false

て烟熏妆下的殇ゞ 提交于 2019-12-24 07:07:16
问题 i am using eclipse and JavaCC plugin 1.5.27 i want to use the parser to be executed more than only once. it goes perfect, if using only once. running the parser within the program a second time i get an error: ERROR: Second call to constructor of static parser. You must either use ReInit() or set the JavaCC option STATIC to false during parser generation. so i add the ReInit() after parsing, but this does not help. this is the code snipped. public static void myParser(String toanalyze) throws

JavaCC - Parse math expressions into a class structure

筅森魡賤 提交于 2019-12-24 05:53:39
问题 I'm using this grammar to calculate math expressions: // Konfiguration (JavaCC-Manual konsultieren) options { STATIC = true; // alle Parser-operationen sind static // verwende zwei Token um zu entscheiden, was passieren soll LOOKAHEAD = 2; } // hier beginnt unsere Parser Klasse ("MathParse") PARSER_BEGIN(MathParse) // hier kann ganz normaler Java-Code verwendet werden public class MathParse { public static void main(String[] args) { // auch ein statischer Parser muss initiiert werden // -

Getting started with JavaCC

ε祈祈猫儿з 提交于 2019-12-21 11:28:36
问题 I am new to JavaCC and cannot figure out how to get it running. I am using Mac OS X and I installed javacc-6.0.zip and unzipped it. I am unable to make the javacc script accessible from my path as on typing javacc on the terminal I get the following message: -bash: javacc: command not found How do I make the javacc script accessible from my path? My unzipped folder javacc-6.0 is in the following directory: /Users/Rishabh/Desktop/javacc So I do the following on the terminal: PATH=$PATH\:/Users

Getting started with JavaCC

三世轮回 提交于 2019-12-21 11:28:28
问题 I am new to JavaCC and cannot figure out how to get it running. I am using Mac OS X and I installed javacc-6.0.zip and unzipped it. I am unable to make the javacc script accessible from my path as on typing javacc on the terminal I get the following message: -bash: javacc: command not found How do I make the javacc script accessible from my path? My unzipped folder javacc-6.0 is in the following directory: /Users/Rishabh/Desktop/javacc So I do the following on the terminal: PATH=$PATH\:/Users

Anybody has some links to javacc tutorials? [closed]

≡放荡痞女 提交于 2019-12-21 07:22:50
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . It's very difficult to find this kind of document online. I found one in JAVAWORLD, but this one does not cover the jjTree and visitor one. Does anybody happen to have some links to the tutorials? 回答1: Its been a while, but I found this tutorial very helpful on a previous project. I was able to create a query

How to implement JavaScript/ECMAScript “no LineTerminator here” rule in JavaCC?

这一生的挚爱 提交于 2019-12-20 05:46:33
问题 I continue working on my JavaCC grammar for ECMAScript 5.1. It actually goes quite well, I think I've covered most of the expressions now. I have now two questions, both of them are related to the automatic semicolon insertion (§7.9.1). This is one of them. The specification defines the following production: PostfixExpression : LeftHandSideExpression LeftHandSideExpression [no LineTerminator here] ++ LeftHandSideExpression [no LineTerminator here] -- How can I implement a reliable "no

How to use backslash escape char for new line in JavaCC?

非 Y 不嫁゛ 提交于 2019-12-20 03:25:10
问题 I have an assignment to create a lexical analyser and I've got everything working except for one bit. I need to create a string that will accept a new line, and the string is delimited by double quotes. The string accepts any number, letter, some specified punctuation, backslashes and double quotes within the delimiters. I can't seem to figure out how to escape a new line character. Is there a certain way of escaping characters like new line and tab? Here's some of my code that might help <

Parsing latex-like language in Java

我是研究僧i 提交于 2019-12-18 18:28:06
问题 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 like JavaCC were only suitable for highly structured code (typical for general-purpose programming languages), not for messy Latex-like markup. So far, it seems

是否有正则表达式来检测有效的正则表达式?

若如初见. 提交于 2019-12-17 11:55:09
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 是否可以使用另一个正则表达式检测有效的正则表达式? 如果是这样,请在下面举例说明。 #1楼 不太可能。 在 try..catch 或您提供的语言中评估它。 #2楼 / ^ # start of string ( # first group start (?: (?:[^?+*{}()[\]\\|]+ # literals and ^, $ | \\. # escaped characters | \[ (?: \^?\\. | \^[^\\] | [^\\^] ) # character classes (?: [^\]\\]+ | \\. )* \] | \( (?:\?[:=!]|\?<[=!]|\?>)? (?1)?? \) # parenthesis, with recursive content | \(\? (?:R|[+-]?\d+) \) # recursive matching ) (?: (?:[?+*]|\{\d+(?:,\d*)?\}) [?+]? )? # quantifiers | \| # alternative )* # repeat content ) # end first group $ # end of string / 这是一个递归正则表达式,许多正则表达式引擎都不支持

How to simplify JavaScript/ECMAScript array literal production?

元气小坏坏 提交于 2019-12-13 17:44:27
问题 I currently implementing a JavaScript/ECMAScript 5.1 parser with JavaCC and have problems with the ArrayLiteral production. ArrayLiteral : [ Elision_opt ] [ ElementList ] [ ElementList , Elision_opt ] ElementList : Elision_opt AssignmentExpression ElementList , Elision_opt AssignmentExpression Elision : , Elision , I have three questions, I'll ask them one by one. I have tried to simplify/to rewrite the ArrayLiteral production depicted above and finally arrived to the following production