parser-generator

Lex and Yacc in PHP [closed]

五迷三道 提交于 2019-12-17 15:36:13
问题 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 . Is there an implementation of Lex and Yacc in PHP? If not, can anyone suggest a lexical analyser and parser generator (ie, anything like Lex and Yacc) that will create PHP code. I'm not too worried about the performance of the resulting parser. I am sick of using regex to parse things that really shouldn't be

Extracting text data from PDF files

人盡茶涼 提交于 2019-12-17 10:22:58
问题 Is it possible to parse text data from PDF files in R? There does not appear to be a relevant package for such extraction, but has anyone attempted or seen this done in R? In Python there is PDFMiner, but I would like to keep this analysis all in R if possible. Any suggestions? 回答1: Linux systems have pdftotext which I had reasonable success with. By default, it creates foo.txt from a give foo.pdf . That said, the text mining packages may have converters. A quick rseek.org search seems to

Source of parsers for programming languages?

纵然是瞬间 提交于 2019-12-13 12:04:30
问题 I'm dusting off an old project of mine which calculates a number of simple metrics about large software projects. One of the metrics is the length of files/classes/methods. Currently my code "guesses" where class/method boundaries are based on a very crude algorithm (traverse the file, maintaining a "current depth" and adjusting it whenever you encounter unquoted brackets; when you return to the level a class or method began on, consider it exited). However, there are many problems with this

json text split reg expression or parser

心不动则不痛 提交于 2019-12-12 01:13:48
问题 $var =" { key : { key_deep : val\{ue /* should be "val{ue" as { is escaped */ } , key2 : value } "; print_r(preg_split('//',$var)); // array( // array( // 'key'=> array( // 'key_deep'=> 'val{ue' // ) // ), // array('key2'=>'value') // ); is there a regular expression to split this using preg_split in php? basically I need the same as json_decode() but without the need of the the quotes on BOTH value and key and the only thing escaped are four characters \{ \, \} \: 回答1: You're probably going

AXE Parser Generator and mingw gcc 4.6 operator &

孤者浪人 提交于 2019-12-11 15:32:57
问题 I'm playing a bit with axe parser framework from gb reasearch and got problems with gcc 4.6.2. With VC++10-Compiler there are no problems. The line: auto space = axe::r_any(" \t"); // trailing spaces auto trailing_spaces = *space & (comma | endl); The error: D:\Projekte\axeparser-build-desktop-Qt_4_8_0__Qt480mingw__Debug\..\axeparser\main.cpp:19: error: conversion from 'axe::r_and_t<axe::r_many_t<axe::r_pred_t<axe::is_any_t<const char*> >&, axe::r_empty_t>, axe::r_or_t<axe::r_char_t<char>&,

Could not load main class in JavaCC

时光毁灭记忆、已成空白 提交于 2019-12-11 02:46:09
问题 I am AI student and we work with JavaCC. I am new with it. I was trying simple example and I had some errors. 1) I downloaded JavaCC 0.6 from it's website 2) I extracted it in disc C 3) I wrote this code in a file with extension ".jj" PARSE_BEGIN(Test) import java.io.*; class Test { public static void main(string [] args) { new Test(new InputStreamReader(System.in)); start(); } } PARSE_END(Test); Token: { <number: (["0"-"9"])+("." (["0"-"9"])+)?(("e"|"E")(["0"-"9"])+)?>| <plus: "+"> } void

How to write a parser in javascript to parse text in editor into JSON with a model?

大兔子大兔子 提交于 2019-12-08 06:11:33
问题 I don't know if it is the place to ask this. But I will try. What I need is, for example, if user writes some text in Code Mirror editor like: a1=Some Text a11 = Some Child text and the parser should check if the grammer is correct, and parse it to: { 'a1' : { 'value' : "Some Text", 'a11' : "some child text" } } Something like this according to the gramme. So, is there any parser library or something in javascript? 回答1: You should be able to use PEG.js to parse the text on the client side. I

Best parser generator for parsing many small texts in C++?

旧城冷巷雨未停 提交于 2019-12-08 03:10:30
问题 I am, for performance reason, porting a C# library to C++. During normal operation, this library needs, amongst other things, to parse about 150'000 math expressions (think excel formulas) with an average length of less than 150 characters. In the C# version, I used GOLD parser to generate parsing code. It can parse all 150'000 expressions in under one second. Because we were thinking about extending our language, I figured the move to C++ might be a good chance to change to ANTLR. I have

Multiple flex/bison parsers

可紊 提交于 2019-12-07 03:19:26
问题 What is the best way to handle multiple Flex/Bison parsers inside a project? I wrote a parser and now I need a second one in the same project. So far in the third section of parser1.y I inserted the main(..) method and called yyparse from there. What I want to obtain is having two different parsers ( parser1.y and parser2.y ) and be able to use them from an external function (let's assume main in main.cpp ). Which precautions should I use to export yyparse functions outside .y files and how

Create a Verilog Parser with Ruby

不羁岁月 提交于 2019-12-06 17:35:28
I would like to create a Verilog parser written in Ruby for a university project I know there are parser generators like Bison and Yacc. Could anyone give me some advice on how to get started? I already have a very basic verilog parser (gem) written in ruby called verilog , if you could consider contributing to that instead, or it might give an idea of how to start. I also have a gem called rubyit , which is command line utility to parse files with erb and generate the standard version of the file. Which can be used for extendable verilog templates, similar to generate statements but gives a