3

Integrate ANTLR 4 into a C ++ application

 2 years ago
source link: https://www.codesd.com/item/integrate-antlr-4-into-a-c-application.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Integrate ANTLR 4 into a C ++ application

advertisements

Recently I picked up a copy of The Definitive ANTLR 4 Reference and since I am sophisticated when it comes to working with grammars and languages I wanted to work on my DSL I once have written using yacc and bison. The general idea is to write a translator (with included validation for type safety(1)) which translates the DSL to JavaScript during runtime which is then executed by v8.

Although ANTLR was designed for inclusion in Java applications I would like to stay with native C++. Can ANTLR 4 produce such a C parser/lexer(2) which I can include using a C++-style wrapper? And how to do so?


(1) The book has some good examples which I will use as a template.
(2) I am not sure but I think that I read somewhere that ANTLR doesn't support output in C++, am I right?


ANTLR v3 has various different targets, most notably Java (of course), C, C#, JavaScript and Python. For a full list, see: http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets

ANTLR v4, however, only has a Java target at this moment.

Related Articles

Integrate a widget into an angular application using a directive

So I have currently integrated Yotpo 'reviews and comments' into my Angular application. It consists of a javascript widget and some Html: Js: var e=document.createElement("script"); e.type="text/javascript", e.async=true, e.src="

How do I integrate Google Maps into a web application?

I have a web application. I want to integrate the Google Maps to show the map of a location where user types in the search location. Any help?If I understood your question correctly, you want your users to search for a location, and then display it o

How can I integrate Oracle BI into an existing application?

I have an existing application written in Perl. Now I need to integrate this application with OBI. The plan is having a button the user can click on to open OBI in an iframe. OBI resides on a different server from the running application. Has anyone

How do I integrate an assembly into a console application without ILMerge?

There are a lot of posts on here about this, I'm using this code from another SO post and placing a delegate assignation in my Main() method. None of the other posts have directly answered my question. I've got my third party assembly embedded as a r

Google Drive API - Can I integrate Google Docs into my web application?

One of the requirements for the web application I'm creating is that users should be able to create and edit documents. I've been searching around and I came across the Google Drive REST API, however I'm a little unsure about what it can do. From wha

The client refuses and ldquo; scripts & rdquo; in the environment. How to integrate a * .ps1 into a C # application?

I have the following sample Powershell script that is embedded in my C# application. Powershell Code $MeasureProps = "AssociatedItemCount", "ItemCount", "TotalItemSize" $Databases = Get-MailboxDatabase -Status foreach($Databa

Integrate the jetty into the java application and export it as a jar

I'm making a java application which embeds a Jetty web server, which in turn serves content developed with Google Web Toolkit. It's all working fine when run in Eclipse, but when I export it as a jar file all I get is a Jetty error message saying "Fi

How do I integrate this control into my Eclipse application?

i was looking for Scrollable Tab for my application, but i m stuck here. i found a website that gives this control. But i don't know how to integrate this in eclipse.? If anybody had used this with eclipse, please guyz share with me. i need to implem

How do I integrate a browser into my tk application?

I am writing a Python program and want at some point to load HTML pages from the web and display them, in particular the support forum section/news section of my program. How can I easily integrate that into my program?It would be easier to switch to

How to integrate Google Ads into an Android application?

I'm integrating Google Ads in Android application. I'm implementing example of google ad mob, which I have getting example from the net. And also I have add external jar file of google-play-service_lib.jar and add the element of <activity android:nam

How do I integrate Perl Interpreter into a C ++ application doing DLL?

I need a DLL built in C++ having Perl interpreter inside it and a Perl library exiftool by Phil Harvey being called by C++ functions. I want to do it on Windows 7 with Visual Studio 2010 VC++ installed. Which Perl distribution is best for this task:

Can you integrate Flash (SWF) into Eclipse-RCP applications

I have no background in Eclipse-RCP. My understanding is that a eclipse-rcp app is a rich client technology similar to Adobe Air. Is it possible to embed a swf flash movie in a panel inside a eclipse-rcp app? Can the flash talk via ExternalInterface

how to integrate flash games into Windows Forms Application.net compact framework under Windows Mobile 6

I want develop an application on windows mobile. In this app, i need to show some Flash games to the end user. How should I do? embed an Flash ActiveX Control (in Windows mobile Form application) ? embed an IE control? BTW (because i do not have a wi

Is it possible to integrate an iBook into an iOS application?

I've got a requirement to build an iBook title for iBooks. But now they're adding new requirements that really don't fit in an iBook, so I was thinking I'd make an app instead that references the iBook, but has additional screens for the more complex

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK