Giter VIP home page Giter VIP logo

antlr4-cpp-example's Introduction

CI

Antlr4 C++ Example

A simple example of using Antlr4 to generate a C++ Parser / Lexer, for Modelica. The Modelica grammar for Antlr4 is from here.

To run the example, simply run ./run.sh or make

The example presumes that the java executable is on your path.

The output includes

modelicaLexer.*: Antlr4 Lexer for Modelica

modelicaParser.*: Antlr4 Parser for Modelica

modelicaListener.*: Antlr4 Listener implementation for Modelica

Note that the Listener classes are optional: not every application of Antlr4 requires a listener.

antlr4-cpp-example's People

Contributors

teverett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

antlr4-cpp-example's Issues

hello.cpp:(.text+0x7c): undefined reference to `antlr4::ANTLRInputStream::ANTLRInputStream(std::istream&)'

Hi, I clone this example in my machine (ubuntu16.04), and meet lots of undefined reference problems when linking all .o .a files together (in step $(CC) $(LDARGS) $(OUTPUT)/hello.o $(OUTPUT)/modelicaBaseListener.o $(OUTPUT)/modelicaLexer.o $(OUTPUT)/modelicaListener.o $(OUTPUT)/modelicaParser.o $(LIBS) -o hello).
hello.cpp:(.text+0x7c): undefined reference to antlr4::ANTLRInputStream::ANTLRInputStream(std::istream&) hello.cpp:(.text+0xb2): undefined reference to antlr4::CommonTokenStream::CommonTokenStream(antlr4::TokenSource*) hello.cpp:(.text+0xc1): undefined reference to antlr4::BufferedTokenStream::fill() hello.cpp:(.text+0xda): undefined reference to antlr4::BufferedTokenStream::getTokens() output/hello.o: In function antlr4::ANTLRInputStream::~ANTLRInputStream(): hello.cpp:(.text._ZN6antlr416ANTLRInputStreamD2Ev[_ZN6antlr416ANTLRInputStreamD5Ev]+0xd): undefined reference to vtable for antlr4::ANTLRInputStream hello.cpp:(.text._ZN6antlr416ANTLRInputStreamD2Ev[_ZN6antlr416ANTLRInputStreamD5Ev]+0x40): undefined reference to antlr4::CharStream::~CharStream()'

However, my classmate is able to make successfully in her macOS.
Any compiler or system requirement to make this hello example ?

Cant use parser.stored_definition()

Hi, i am working on a project of a compiler in cpp for Decaf. I have al ready generated the lexer an parser based on decaf grammar, i was using your hello.cpp for a guide but couldn't use the parser.stored_definition().

Everything else is working ok.

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.