yacc

SQL lex yacc grammar

拟墨画扇 提交于 2019-12-17 18:44:09
问题 All, Developing a validating application for embedded sql i'll use ansi c or c++ as developement language Where do i get an sql grammar for lex and yacc? 回答1: hi there is a solution in google projects yaxx: yac file: lex file enjoy 回答2: There is book named "flex & bison" by John Levine (Author). in this book there is a complete chapter for sql parser. you can download this book for free here 来源: https://stackoverflow.com/questions/8656926/sql-lex-yacc-grammar

Advantages of Antlr (versus say, lex/yacc/bison) [closed]

泄露秘密 提交于 2019-12-17 17:23:44
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I've used lex and yacc (more usually bison) in the past for various projects, usually translators (such as a subset of EDIF streamed into an EDA app). Additionally, I've had to support code based on lex/yacc grammars dating back decades. So I know my way around the tools,

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

Lex/Yacc for C#?

一世执手 提交于 2019-12-17 09:33:39
问题 Actually, maybe not full-blown Lex/Yacc. I'm implementing a command-interpreter front-end to administer a webapp. I'm looking for something that'll take a grammar definition and turn it into a parser that directly invokes methods on my object. Similar to how ASP.NET MVC can figure out which controller method to invoke, and how to pony up the arguments. So, if the user types "create foo" at my command-prompt, it should transparently call a method: private void Create(string id) { /* ... */ }

Cannot find -ly error

China☆狼群 提交于 2019-12-16 18:03:45
问题 I am trying to run a lexx and yacc program and I got the following error: /usr/bin/ld: cannot find -ly collect2: error: ld returned 1 exit status Plz tell me which libraries am I supposed to add? 回答1: I would guess the problem is that you're using a version of yacc other than the old AT&T yacc which doesn't come with liby (the -ly you have). So you need to remove the -ly option from your command line, and provide your own implementations of main and yyerror . 回答2: What version of yacc and lex

LEX -YACC parser for infix-to-prefix translation

本小妞迷上赌 提交于 2019-12-14 03:34:08
问题 Translation schemes: expr -> {print("+")} expr + term | {print("-")} expr - term | term term -> {print("*")} term * factor | {print("/")} term / factor | factor factor -> digit {print(digit)} | (expr) Above grammar will print the expression in prefix form. For this grammar it is not possible to write the parser. how could we write the lex and yacc program to convert infix to prefix. I follow this lex and yacc program to convert infix to prefix but not getting proper output. Any idea how to

How to list lex/yacc or flex/bison patterns?

久未见 提交于 2019-12-13 23:56:41
问题 I would like to extract all patterns from a flex/bison file to look at them altogether. I am not interested in the rules applying to the patterns for now. Surely someone has written a flex/bison file for this already? :) 回答1: If you give it the -v command-line option, bison will output a nicely formatted version of the grammar (and all the states) to a file with extension .output . You can specify the precise file name to write to with --report-file=PATH and a list of things to report on with

Print tokens properly using Lex and Yacc

倾然丶 夕夏残阳落幕 提交于 2019-12-13 05:32:48
问题 I'm having difficulties printing a sequence of tokens that behaves recursively. To better explain, I will show the sections of the corresponding codes: First, the code on Lex: %{ #include <stdio.h> #include "y.tab.h" installID(){ } %} abreparentese "(" fechaparentese ")" pontoevirgula ";" virgula "," id {letra}(({letra}|{digito})|({letra}|{digito}|{underline}))* digito [0-9] letra [a-z|A-Z] porreal "%real" portexto "%texto" porinteiro "%inteiro" leia "leia" %% {abreparentese} { return

Distinguishing identifiers from common strings

风格不统一 提交于 2019-12-13 04:49:39
问题 I want to write a parser using Bison/Yacc + Lex which can parse statements like: VARIABLE_ID = 'STRING' where: ID [a-zA-Z_][a-zA-Z0-9_]* and: STRING [a-zA-Z0-9_]+ So, var1 = '123abc' is a valid statement while 1var = '123abc' isn't. Therefore, a VARIABLE_ID is a STRING but a STRING not always is a VARIABLE_ID . What I would like to know is if the only way to distinguish between the two is writing a checking procedure at a higher level (i.e. inside Bison code) or if I can work it out in the

YACC Rules not reduced

北战南征 提交于 2019-12-13 04:48:44
问题 This is my code calc.y. I keep getting the error: yacc: 1 rule never reduced yacc: 3 reduce/reduce conflicts not really sure what this means Ive done some research in other places but I am now lost. Im guessing the rules being referred to is program and statement but even so... what does the reduce rule mean? %{ #include <stdio.h> FILE *outfile; int yyline = 1; int yycolumn = 1; %} %union{ int nw; struct{ int v; char s[1000]; }attr; } %token SEMInumber %token LPARENnumber %token <nw>