Git Product home page Git Product logo

antlr4_javascript_demo's Introduction

Simple example of how to use Antlr4 in Javascript. Also a test to see how long it takes me to be able to make something in Node. Also Also part of a project with Drew Winget to build a demo that animates order of operations of algebra.

Requirements: antlr4-javascript: https://github.com/antlr/antlr4-javascript (Should be in a repo soon) ANTLR>=4.5: http://www.antlr.org/download.html (Select Complete ANTLR 4.5 Java binaries jar) Java Runtime Environment: OS dependent. (Needed just to compile the .g file into javascript)

Build Steps: alias antlr4='java -jar "/path/to/antlr-4.5-complete.jar"' antlr4 Calculator.g

Running: Put antlr4-javascript/src/antlr4 (or a package) in your path (You can specify it bash with NODE_PATH='') node run_calculator.js '-2(3+4)^2' # Simplify an expression with basic PEMDAS order of operations. node run_AST.js '-2(3+4)^2' # Product AST in sample JSON format. Format is not supposed to be final and is more of a demonstration of how a structure could be generated from the parser.

Other Stuff: Uncomment the following line in the run_*.js files for more detailed logging. //listener.loginfo=true;

antlr4_javascript_demo's People

Contributors

diamondman avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.