I'm trying to parse a grammar in ocamlyacc (pretty much the same as regular yacc) which supports function application with no operators (like in Ocaml or Haskell), and the normal assortment of binary and unary operators. I'm getting a reduce/reduce conflict with the '-' operator, which can be used both for subtraction and negation. Here ...
How do I compile, link and call different YACC grammars using yyparse() in one program?
...
Yacc does not permit objects to be passed around. Because the %union can only contain POD types, complex objects must be new'd and passed around by pointer. If a syntax error occurs, the yacc parser just stops running, and references to all of those created objects are lost.
The only solution I've come up with is that all new'd object i...
I'm writing a C parser using PLY, and recently ran into a problem.
This code:
typedef int my_type;
my_type x;
Is correct C code, because my_type is defined as a type previously to
being used as such. I handle it by filling a type symbol table in the
parser that gets used by the lexer to differentiate between types and
simple identifie...
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, though I'm no expert.
I've seen positive comments about Antlr in ...
The software base I am developing for uses a signficant amount of yacc which I don't need to deal with. Some times I think it would be helpful in understanding some problems I find but most of the time I can get away with my complete ignorance of yacc.
My question are there enough new projects out there that still use yacc to warrant th...
Hi!
I want to make some variables I generate in b available in c:
a : b c { ...some code...}
A simple example:
b : X { int result = 0; }
| Y { int result = 1; }
so I can, later on in c say:
c : D { printf(result + 1); }
| E { printf(result + 2); }
Is there any chance to do that? Any help would really be apprecia...
Is there a way to execute code after each Terminal?
So that something like this is possible:
a : B { code } C { some code }
Any help would really be appreciated!
...
MKS Yacc supports a notation which their web site calls "selection preference syntax". It isn't illustrated, but it consists of a token in square brackets, optionally with a caret, and it indicates that a particular token is required to follow, or is required not to follow, the rest of the rules:
non_terminal: TOKEN1 non_terminal2 TOK...
Since I've gotten no answer at all to my question Is there an alternative to MKS Yacc that supports selection preference syntax or something very similar?, I'll ask the more basic question:
Has anyone used the "selection preferences" provided by MKS Yacc?
If you have, what did you use it for? Also, does it make any sense to use it i...
I am trying to build a Lisp grammar. Easy, right? Apparently not.
I present these inputs and receive errors...
( 1 1)
23 23 23
ui ui
This is the grammar...
%%
sexpr: atom {printf("matched sexpr\n");}
| list
;
list: '(' members ')' {printf("matched list\n");}
| '('')' {printf("matched...
What are some good tools for getting a quick start for parsing and analyzing C/C++ code?
In particular, I'm looking for open source tools that handle the C/C++ preprocessor and language. Preferably, these tools would use lex/yacc (or flex/bison) for the grammar, and not be too complicated. They should handle the latest ANSI C/C++ defi...
Hi guys, I'm trying to write a shell using yacc and lex and I'm running into some problems with my I/O redirectors. Currently, I can use the < and > operators fine and in any order, but my problem is I can redirect twice with no error, such as "ls > log > log2"
My rule code is below, can anyone give me some tips on how to fix this? Than...
I'm trying to work on a kind of code generator to help unit-testing an legacy C/C++ blended project. I don't find any kind of independent tool can generate stub code from declaration. So I decide to build one, it shouldn't be that hard.
Please, anybody can point me a standard grammar link, better described by yacc language.
Hope I'm n...
What is the difference between Flex & Lex and Yacc & Bison. I searched the Internet wildly and I didn't find any solid answer.
Can I install pure Lex and Yacc on Ubuntu, or I can install only flex and bison. I am confused.
Is Lex or Yacc still being maintained by someone ?
Are all of them free ?
If Lex is not free why do I have it in...
Could somebody post a link to some excellent tutorials for lex and yacc?
...
I'm writing an assembler for a microprocessor I'm creating using lex/yacc.
I'd like to implement labels in my assembler code, and I thought a good way to do this would be to have a dictionary of labels in the form {name:line#}. I could then check when inserting a label, if it's already defined, its an error.
So how can I use a dictiona...
I have an application where I already have a parser for one sort of grammar and I need to add a second different grammar for another purpose.
Is it possible to have more than one?
And if so how do you get another entry point?
Thanks
david allan finch
...
Hi,
I'm trying to figure out how I can display a message/prompt when using lex/yacc (flex/bison).
For instance, main looks like so:
int main(int argc, char *argv[])
{
yyparse();
}
Which calls yacc, which calls yylex(). This yields a blank line waiting on STDIN. How can i display a message like...
message $ _
instead of
_
Whe...