I have 3 standalone c++ componenets i.e Driver , Parser and Translater
Driver connects to data source and fetches data , parser parses data and Transform converts the data as needed i.e the flow of data looks like below
Driver.Out --> Parser.In -- Parser.Out --> Translator.In
I want to write a runtime interpreter which ties these components with Queues and produce the desired output.
I wanna use this interpreter as many times as possible , each being a independent Process
Any thoughts will be highly appreciated
Did you consider embedding an interpreter like lua inside your application, or embed your application as an extension for ocaml or python
But I don't understand exactly your question.
Use flex and bison. A good book on how to write interpreters or compilers with them is Flex & Bison: Text Processing Tools by John Levine.
Related
I am writing a parser for a hugely complex internal file format - for training purposes. I need to implement some sort of DSL for parsing - and then display the sections of format in a GUI, as some sort of a tree view. I want to be able to have the parsing engine in one process and the UI in another. So for example I want the UI to ask the parser engine to parse a file. The parser then returns some sort of tree containing sections and fields in the tree, and the GUI then displays it.
How do I make them communicate? (The language is C++). Do I make the engine a DLL and export the needed functions or how else to implement this. I cannot use external libraries.
Not a big problem. The interaction is one way, that helps a lot. Define an output format for the parser/input format for the UK, before writing either. If the format is well defined, you can even have two developers write the two parts independently.
Our application can generate some fairly long report files interactively. We use C++ to generate all the output, but redirected through a TCL console and TCL channel so we can take advantage of output logging etc.
Is there any common way to support paging of output in C++. I've casted around but can't find anything.
Best
Sam
OK, so the situation is that you're writing to a Tcl_Channel that a Tcl interpreter is also writing to. That should work. The simplest way to put paging on top of that is to make that channel be one of the standard channels (I'd pick stdout) and feed the whole lot through a pager program like more or less. That'll only take you a few seconds to get working.
Otherwise, it's possible to write a channel in Tcl 8.5 using just Tcl code; that's what a reflected channel is (that's the Tcl 8.6 documentation, but it works the same way in 8.5). However, using that to do a pager is going to be quite a lot of work; channels work with bytes not characters. It's probably also possible to do it using a stacked channel transformation (8.6 only).
However, if sending the output to a Tk text widget is acceptable (I know it isn't precisely what you asked for…) there's already a package in Tcllib for it.
package require Tk
package require tcl::chan::textwindow
pack [text .t]
set channel [tcl::chan::textwindow .t]
puts $channel "This is a simple test."
That (write-only) channel will work fine if you pass it to your C++ code to use. (You can inspect the source to see how it is done if you wish; the code is pretty short.)
Is there a library that will allow easier generation of a simple website using C++ code. This 'website' will then be compiled into a CHM help file (which is the final goal here). Ideally, it will allow generation of pages easily and allow links to be generated between pages easily. I can do this all by hand, but that is going be very tedious and error prone.
I know about bigger libraries such as Wt, but am more interested in smaller ones with little or no dependencies and a need for installation.
You can try CTPP template engine. It is written in C++ is small and quite fast.
Do you need this project to be written in c++? Because if you just need to prepare documentation in CHM I would go with Sphinx. Sphinx is a set of tools written in Python that generate manuals in few formats (chm, html, LaTeX, PDF) from text files (formated using reStructuredText markup language). Those text files could be created by hand or using some application and then combined into one manual using Sphinx. In my work right now we are using this solution to write documentation, because it is very easy to maintain text files (merging, tracking changes etc.) than for example html or doc. Sphinx is used to generate Python language documentation (chm), so it is capable to handle really large project.
I've used the FLATE library every day for ten years and it works flawlessly. It's a piece of cake to use; I can't recommend it enough.
It will definitely do the trick, though probably at a much lower level than you have in mind. It is a C-language source library that you can link with a C++ caller. It's also available as a Perl module, but I haven't used that.
FLATE library
Flate is a template library used to deal with html code in CGI applications. The library includes C and Perl support. All html code is put in an external file (the template) and printed using the library functions: variables, zones (parts to be displayed or not) and tables (parts to be displayed 0 to n times). Using this method you don't need to modify/recompile your application when modifying html code, printing order doesn't matter in your CGI code, and your CGI code is much cleaner.
HTH and good luck!
Are this CHM lib and the related links what you're looking for?
I need to write a program that displays a PDF which a third-party supplies. I need to insert text data in to the form before displaying it to the user. I do have the option to convert the PDF in to another format, but it has to look exactly like the original PDF. C++ is the preferred language of choice, but other languages can be investigated (e.g. C#). It need to work on a Windows desktop machine.
What libraries, tools, strategies, or other programming languages do you suggest investigate to accomplish this task? Are there any online examples you could direct me to.
Thank-you in advance.
What about PoDoFo:
The PoDoFo library is a free, portable
C++ library which includes classes to
parse PDF files and modify their
contents into memory. The changes can
be written back to disk easily. The
parser can also be used to extract
information from a PDF file (for
example the parser could be used in a
PDF viewer). Besides parsing PoDoFo
includes also very simple classes to
create your own PDF files. All classes
are documented so it is easy to start
writing your own application using
PoDoFo.
iTextSharp is a free library that you can use in .Net applications. Take a look at the iText page - that is for the iText project, which is a Java library. iTextSharp is part of that project, and is a port to C# and .Net.
Consider Python It have a lot PDF librarys (both creating and extracting) eg:
http://pypi.python.org/pypi/pdfsplit/0.4.2
http://pypi.python.org/pypi/JagPDF/1.4.0
http://pypi.python.org/pypi/pdfminer/20091129
http://pypi.python.org/pypi/podofo/0.0.1
http://pypi.python.org/pypi/pyFPDF/1.52
There are also good tools for using C/C++ code in Python and to create .exe form Python scripts. If you decide to use different language consider Python as prototyping language!
Im looking to see if there are any pre-existing projects that do this.
Generally, I need something that will load in a c++ file and parse it and then based on a set of rules in script, transform it, say to add headers, reformat, or remove coding quirks for example, turning const int parameters in functions to int parameters, etc Or perhaps something that would generate a dom of some sorts based on the c++ file fed in that could be manipulated and written out again.
Are there any such projects/products out there free or commercial?
Taras Glek of Mozilla has been working on the dehydra tool, based on Elkhound and scripted using JavaScript to transform the Mozilla codebase to fit with XPCOM and garbage collector changes.
The Parser from Eclipse CDT seems to be pretty complete by now, as some refactoring methods have been alredy contributed to CDT.