parser-generator

Negating inside lexer- and parser rules

て烟熏妆下的殇ゞ 提交于 2019-11-27 08:39:42
How can the negation meta-character, ~ , be used in ANTLR's lexer- and parser rules? Bart Kiers Negating can occur inside lexer and parser rules . Inside lexer rules you can negate characters, and inside parser rules you can negate tokens (lexer rules). But both lexer- and parser rules can only negate either single characters, or single tokens, respectively. A couple of examples: lexer rules To match one or more characters except lowercase ascii letters, you can do: NO_LOWERCASE : ~('a'..'z')+ ; (the negation-meta-char, ~ , has a higher precedence than the + , so the rule above equals (~('a'..

What is a good C# compiler-compiler/parser generator? [closed]

╄→гoц情女王★ 提交于 2019-11-27 07:37:18
I'm looking for a parser generator that given an EBNF for a LL(k) language will give me a C# parser and generate classes the types defined in the EBNF. plinth Gold is OK as far a parser generators go. ANTLR (nothing else to say) You might want to look at MinosseCC , a port of JavaCC to C#. Another possibility is Spart . Find Irony in http://irony.codeplex.com/ PROS: It is simple CONS: -Lack of document -Rather Slow There is a new parser generator on the block called LLLPG , that supports LL(k) grammars and zero-width assertions. It can be used without a runtime library (a base class suffices).

Processing repeatedly structured text file with python

随声附和 提交于 2019-11-27 03:39:45
问题 I have a big text file structured in blocks like: Student = { PInfo = { ID = 0001; Name.First = "Joe"; Name.Last = "Burger"; DOB = "01/01/2000"; }; School = "West High"; Address = { Str1 = "001 Main St."; Zip = 12345; }; }; Student = { PInfo = { ID = 0002; Name.First = "John"; Name.Last = "Smith"; DOB = "02/02/2002"; }; School = "East High"; Address = { Str1 = "001 40nd St."; Zip = 12346; }; Club = "Football"; }; .... The Student blocks share the same entries like "PInfo", "School" and

Parser, Generator for Java with the following requirements

天涯浪子 提交于 2019-11-27 02:57:45
问题 I am looking for a parser generator for Java that does the following: My language project is pretty simple and only contains a small set of tokens. Output in pure READABLE Java code so that I can modify it (this why I wouldn't use ANTLR) Mature library, that will run and work with at least Java 1.4 I have looked at the following and they might work: JavaCC, jlex, Ragel? 回答1: You should use Rats... This way, you don't have to separate lexer and parser and then if you want to extend your

PHP Lexer and Parser Generator? [closed]

跟風遠走 提交于 2019-11-27 01:23:50
问题 I know question Lex and Yacc in PHP was asked before but 1 year ago. Is there any new mature PHP parser generator now? My searches drove me to the following ones, what do you think about them, any others? code.google.com/p/antlrphpruntime/ : The ANTLR PHP version but it seems to be very beta version and I think there is a lot of work to do. The advantage is that I can write the grammar in the ANTLR Works tool. pear.php.net/package/PHP_ParserGenerator/docs/0.1.7/ : I tried but it seems very

How do I get an Antlr Parser rule to read from both default AND hidden channel

只谈情不闲聊 提交于 2019-11-26 23:17:22
问题 I use the normal whitespace separation into the hidden channel but I have one rule where I would like to include any whitespace for later processing but any example I have found requires some very strange manual coding. Is there no easy option to read from multiple channels like the option to put the whitespace there from the beginning. Ex. this is the WhiteSpace lexer rule WS : ( ' ' | '\t' | '\r' | '\n' ) {$channel=HIDDEN;} ; And this is my rule where I would like to include whitespace raw

What is a good C# compiler-compiler/parser generator? [closed]

為{幸葍}努か 提交于 2019-11-26 13:46:57
问题 I'm looking for a parser generator that given an EBNF for a LL(k) language will give me a C# parser and generate classes the types defined in the EBNF. 回答1: Gold is OK as far a parser generators go. 回答2: ANTLR (nothing else to say) 回答3: You might want to look at MinosseCC, a port of JavaCC to C#. Another possibility is Spart. 回答4: Find Irony in http://irony.codeplex.com/ PROS: It is simple CONS: -Lack of document -Rather Slow 回答5: There is a new parser generator on the block called LLLPG,