Giter VIP home page Giter VIP logo

flex-bison-cpp's Introduction

Flex/Bison C++ (Lex/Yacc C++)

A very simple code generator to make it easier to use Flex/Bison (Lex/Yacc) in C++.
Don't expect magic :)

This project is based on the Jonathan Beard's tutorial:
http://www.jonathanbeard.io/tutorials/FlexBisonC++

Usage

After downloading the code...

./create.sh <grammar> <namespace>

will generate a few files in the output folder that are ready to be modified/incremented and used inside a C++ project.

Replace <grammar> by a grammar name and <namespace> by the name space in which all classes will be declared.

Testing

Even without modifications, the generated code is ready to be compiled and tested. The default parser will read numbers, strings and identifiers echoing them back to the screen.

To test...

./create.sh Echo Parser
cd output/test
make
./Echo

and type some numbers, strings and identifiers.

An example of output:

24061960
Integer: 24061960
counter
Identifier: counter
"porto alegre"
String: porto alegre
2.71828
Float: 2.71828

Dependencies

sudo apt-get install flex (flex >= 2.6)
sudo apt-get install bison

flex-bison-cpp's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.