Flex integration with Bison - c++

Environment:
flex 2.6.4
cygwin 3.4.5
Win10
I'm having issues trying to integrate flax and bison. The first question is is flex still viable, or is it no longer maintained and is another lexer advised?
Issues:
The generated flex header file doesn't appear to have yylex in it.
Bison doesn't appear to instantiate a flex class.
An arbitrary file/lexer function name in flex is not reproducible in bison. In my case the output file is SlipFlex.* and the lexer is Sliplex().
The last release version data on 6 Mar 2017 for v2.6.4 although there still is activity.
There is a generated statement that the C++ interface is flawed and will either be fixed or removed.
I guess my question is is it better to just scrap Bison/Flex and go on to another parser/lexer generator?

Related

Which features of C# 7.0 are available in VS "15" Preview?

As you know in build 2016 conference, next version of visual studio was introduced as Visual Studio Enterprise “15” Preview. I downloaded ISO of this preview to check out C# 7.0 new features. As was said in C# presentation session on build conference, I added __DEMO__ and __DEMO_EXPERIMENTAL__ conditional compilation symbols to my project. Now I got these features working:
Local Functions
Digit Separators
Binary Literals
Pattern Matching
But these two do not working and build fails with errors:
Ref Returns and Ref Locals
Tuple Literal Syntax
Can you help me why I can not test these two last feature?
As of today, April 12, 2016 # 12:16 PM (CDT) the tuple feature is in its "prototyping" phase and not yet available. This is regardless of the conditional compilation symbols. Please check out the Roslyn language feature status for details on C# 7.0.
Actually, in looking more closely at the list -- it seems as though pattern matching is in "prototyping" too, which means I must stand corrected. If that is the case, then you should be able to pull down the Roslyn compiler locally from the tuple branch found here. Then use this build to compile your experimental code as defined here.
Visual Studio 15 Preview will only let you play with some of the proposed features of C# 7.0, more specifically:
local functions
digit separators
binary literals
ref returns
and pattern matching
Basically the stuff you already mentioned. Here is the source. It's unclear when the others will be made available.

Pseudocode Translation

I started working just a few hours ago on a pseudocode translator, which will translate a specific pseudocode, reguarding work with stacks and queues, to c/c++ executable code. The translator has education propuses.
I am still designing the project.
I've started thinking about how this could be done; I figured that maybe the best way to do this is to, in the first place, analize the pseudocode, change it to make it c/c++ code and then compiling it to make it an exe.
NOW, this would mean that the client machine SHOULD HAVE a c/c++ compiler installed on it.
As I'm working with .NET clases ( System.Collections.Generic.Queue(Of T) and System.Collections.Generic.Stack(Of T) ), I thought that a solution to this would be to use the same compiler visual studio uses to compile c/c++ code.
I've been investigating about this proccess, and as far as I know, the only way to compile c/c++ code by using a visual studio tool, is executing cl.exe from the Visual Studio Command Prompt. I found that information here at MSDN (article about how to manually compiling a c/c++ program)
So my first question is: does the USER versión of .NET Framework (this means, assuming the user DOES NOT have Visual Studio) include a c/c++ compiler? If yes, is it the same included in visual studio, cl.exe? How can I get access to it? If no, is there a free compiler WITHOUT IDE I can include on my translator setup?
Notice that here we're talking about transforming a pseudocode string to executable c/c++ code here, the output string MUST BE COMPILED FROM THE USER PC, that's what the project is about.
There is no compiler included in the .Net framework - it is for running binary files produced by the compiler.
It's possible to get the compiler for free through for example the Visual Studio Express free download scheme. There are some license limitations on that ("no commercial use", if I remember correctly - so that would mean that if one of your customers uses your product, they can no sell the resulting code they have produced [and still be within the contract with MS]). Unfortunately, this isn't "without IDE", but the compiler that is part of the download is usable without the IDE, so if "without IDE" is simply that you want to be able to run the compiler with your program, then it will work.
If you really need a package that contains the compiler (in .Net variant) but no IDE code, then you will have to find a different solution - and for .Net I'm not sure there is one. The DDK (Device Driver Kit) contains the native C and C++ compilers. But it won't, as far as I understand, produce .Net code [I could be wrong].
Edit: It seems like if you are writing your own code, you can compile it using CSharpCodeProvider - however, this is not the same as a command-line compiler of cl.exe.
The long, the short, and the ugly is "no". The only C++ compiler remotely suitable for inclusion as a library is Clang, it's free and not toooooo bad to work with, and you'll have to write your own .NET binding, and don't forget to have fun with providing your own linker and stdlib.

How to compile V-USB for arduino?

Simply put, I downloaded a port of V-USB for Arduino and can't seem to compile the example that came with it. I get the following message when trying to compile using Arduino IDE 1.0.1
avr-gcc: error: unrecognized command line option '-assembler-with-cpp'
I understand that this is most likely version incompatibility issue and could be avoided by downgrading my avr-gcc to an older version, but is it possible to do some trick to make it compile using the up to date version of avr-gcc?
Just a few notes about environment I'm trying this on
OS: Fedora release 17 (Beefy Miracle)
avr-gcc: (Fedora 4.7.2-1.fc17) 4.7.2
Arduino IDE: (arduino-1.0.1-1.fc17) 1.0.1
The -assembler-with-cpp option instructs the compiler to consider all following files to be assembler files requiring preprocessing. From a quick glance in v-usb, they provide .asm wrappers for .S files. You don't need to use those and the compiler will recognize the .S files automatically without any options.
If the problem isn't with the .asm wrappers detailed above, you can rename the files in question to .S.
Have you tried compiling without the flag? What happened?
With the hints from Jester I managed to solve this problem by updating the IDE to version 1.0.3 (1.0.2 might work as well) and it worked like a charm.
So I guess the problem wasn't the code or compiler, the problem was that the IDE 1.0.1 was expecting an older version of the avr-gcc and used a deprecated flag for compiling and simply failed since that flag is no longer available on the new compiler so you either have to downgrade the compiler or upgrade the IDE and from my perspective, upgrading is always the right choice to make.

Is there a way to manually expand variadic templates?

Visual Studio does not currently support Variadic Templates and the official word is that VS2012 still will not support them.
I've ported my open source project to use C++11 and Variadic Templates are a huge part of that port. This means I can support clang++ 3.1 and g++ 4.5 but not Visual Studio.
So, my question is, does there exist a tool which will let me manually expand my variadic templates (to some N arguments) and check those into source control so that I can have stop-gap support for VisualStudio?
I recently wrote a tool to do exactly this (with the new VStudio 2012 C++ compiler not having support, I don't expect to get variadic templates for another year)
It's very basic, but I thought since there might be interest I might as well publish it.
You can download it from my website here: http://mlvdmeide.com/varexp

parser for developing c++ code coverage tool

I am developing a c++ code coverage tool. Are there any tools available for developing code coverage applications like parsers, etc.
I'd suggest that you look at the existing compilers and use their parsing abilities. For example there's clang/LLVM which already implements static code analysis of some form. Or you could use the built-in parser of the GNU Compilers/g++. IIRC, the new Visual Studio 2010 SDK also allows you to tap directly into the online compiler (that's also used for the new intellisense).
See my paper Branch Coverage Branch Coverage for Arbitrary Languages Made Easy which describes how to build test coverage tools using a program transformation system, by parsing source text, building an AST, and applying rewrite rules to insert test coverage probes, and prettyprinting the modified source code for compilation/execution/test probe data collection.
While the technique works with any system that can parse and prettyprint C++, as general rule these are hard to find, because parsing C++ is difficult. The paper particularly focuses on our our DMS Software Reengineering Toolkit, which has full C++ Front End, and for which we have built a C++ Test Coverage tool.