I write 3 .lex files for 3 different format file parsing, after generating scanner c code, I need to build these 3 file into a single executable but it failed for reason like “multiple definition of 'yy_switch_to_buffer(...)'”, “multiple definition of 'yytext'”, ...
How to solve this?
(Answered by the OP in a comment. Converted to a community wiki answer to suit the Q&A style of Stackoverflow.)
The OP wrote:
Use the %option prefix=“zz” to replace the default functions with zz-prefixed macros. Also ylwrap in autotools seems only handle scanner C file named lex.yy.c, so %option outfile=“lex.yy.c” is needed too.
Related
I'm looking for a libc implementation in a single C source file.
Previously, I tried decompiling musl's libc.so with Ghidra but the result contained too many errors. Even after manually fixing these errors the result is too far removed from the original source code for my needs.
I found this but I was hoping to find something more complete. For example, including some of the math.h functions and printf.
Then today I found a mention of the VAX/VMS C compiler in a comment on this answer which states:
The VAX/VMS C compiler kept all the C runtime library headers in a single textual library file (similar to a unix archive), and used the string between the < and > as the key to index into the library. –
Adrian McCarthy
Feb 15, 2017 at 23:14
This might fit my needs, if the "textual library file" contains C source code.
So primarily I'm looking for a single-file libc.c implementation. But if someone has a link to this VAX/VMS C compiler archive file, I'd be interested in that too.
I would like to ask if you know a way how to make Doxygen ignore some keywords in code.
I use C in automation project (created in B+R Automation Studio) so there are Local and Global variables definitions.
Example:
_Local int variable1
_Global int variable2
This causes problems to Doxygen generated documentation.
What I need is to ignore bold part of variable definition but I only found a way how to ignore bigger part of code (unfortunately syntax have to stay exactly as in example).
Thank you for your advice and/or answers.
Cheers,
Pavel
The possibilities doxygen has for this are:
create an INPUT_FILTER filtering away the unwanted parts
have a look at the preprocessing possibilities and define all names
define all the names in an include file and include this file conditionally and run with preprocessing
For all possibilities see the documentation in the configuration file section
I am using Antlr V4 and grammar file to parse the entire code. The parser, lexer, baselistener are generated from the grammar file using Antlr jar. And then call the appropriate context to scan the entire file.
e.g. For java, the context used is compilationUnit; for C++, the context is translationunit; for Javascript the context is program etc. These context keywords for different languages are defined in their respective grammar file, wherever EOF(End of file) is declared.
e.g.
compilationUnit :packageDeclaration? importDeclaration* typeDeclaration* EOF;
This is few lines in Java8.g4 file where EOF is declared under compilationUnit. So compilationUnit is the context that should be used to scan the entire java file. Similar is the situation for other languages.
But similar context finding isn't possible for scala language. As no EOF is defined in Scala.g4 file. I am referring to scala grammar file from following link.
https://github.com/antlr/grammars-v4/tree/master/scala
All the grammar files for different languages that I use are from the same github page.
This anomaly in scala.g4 file leads to the question; is scala.g4 file not complete or erroneous? Or am I missing anything here?
Basic question is what's the context that should be used to scan entire scala file with the help of Antlr.
Actually, these grammars are developed and supported by an open-source community, not by official language developers.
Of course, some grammars can be incomplete or written in different styles. If you want you can add EOF token to Scala grammar by yourself and make a pull request.
It's also possible to add EOF token programmatically to any rule.
I tried to configure perl-5.18.2.
In checking C library phase, I got following messages.
Checking for GNU C Library...
You are not using the GNU C Library
I can use /mingw/bin/nm to extract the symbols from your C libraries. This
is a time consuming task which may generate huge output on the disk (up
to 3 megabytes) but that should make the symbols extraction faster. The
alternative is to skip the 'nm' extraction part and to compile a small
test program instead to determine whether each symbol is present. If
you have a fast C compiler and/or if your 'nm' output cannot be parsed,
this may be the best solution.
You probably shouldn't let me use 'nm' if you are using the GNU C Library.
Shall I use /mingw/bin/nm to extract C symbols from the libraries? [y] /mingw/bi
n/x86_64-w64-mingw32-nm.exe
I can't seem to find your C library. I've looked in the following places:
/lib
/usr/lib
None of these seems to contain your C library. I need to get its name...
Where is your C library?
Where is my C library?
I've tried /mingw/bin/nm.exe too.
http://search.cpan.org/dist/perl-5.18.2/README.win32:
The INSTALL file in the perl top-level has much information that is only relevant to people building Perl on Unix-like systems. In particular, you can safely ignore any information that talks about "Configure".
Instead, follow the instructions in the README.win32 file.
How to access identifiers used in C program using AST.
I am new to eclipse plugin development and trying to customize eclipse plug-in to ensure that the variable name, function name, structure or whatever the programmer declares should not contain some specific set of words.
Please let me know some good CDT AST guide with examples. Thank you!
Over two weeks with zero responses. Looks like you are not going to get an answer.
I don't know how to help with CDT.
Our DMS Software Reengineering Toolkit with is C Front End parses C, builds ASTs and full C symbol table for a variety of dialects of C. Given this, it is rather easy to enumerate the C symbol table entries, and run an arbitrary predicate on names to see if they violate your conventions.