GithubHelp home page GithubHelp logo

cbleser / nodejs-parser-generator-based-on-antlr3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kyr0/nodejs-parser-generator-based-on-antlr3

0.0 2.0 0.0 8.8 MB

Node.JS parser generator; working ANTLR 3 / JavaScript backend to generate JavaScript-based computer language parsers easily.

License: Other

JavaScript 30.72% GAP 2.44% Erlang 0.01% Prolog 0.01% HTML 66.81% CSS 0.02%

nodejs-parser-generator-based-on-antlr3's Introduction

Node.JS parser generator, based on ANTLR 3

This repository contains the JavaScript runtime of ANTLR 3 which was modified to work inside of a Node.js environment. It also contains scripts to generate grammar parsers and lexers for any compatible ANTLR 3 grammar / computer programming language.

In practice: Using this project, you may generate a JavaScript CSV parser or JavaScript JavaScript parser easily.

Credits: This project was built on ANTLR 3. Thanks to Terence Parr and the developers of ANTLR. See the LICENSE file for more details on licensing. (http://www.antlr.org)

Usage

  1. Generating a parser/lexer:

    node generate.js $grammarName

    Example:

    node generate.js JavaScript

    (Displayed output is the recent parser state.)

    Notice: Before generating a parser for a grammar, not contained in this repository, write it yourself or download it from: http://www.antlr.org/grammar/list and save it to ./grammars/$grammarName.g

  2. Parsing source code by a generated parser/lexer (and log parser's state):

    node parse.js $grammarName $sourceFile

    Example:

    node parse.js JavaScript examples/JavaScript.js

Dependencies

  1. parse.js and generate.js runs on Unix and Linux. Windows is known to be unsupported. You can call all shell commands to generate a parser manually too. (Read the code.)

  2. Requires a Java 1.5+ JVM to be installed to be able to generate parsers using ANTLR 3. Generated parsers and their runtime are JavaScript-only and don't belong to Java anymore.

Limitations

Doesn't work with grammars that make use of @members or @header directives. (Due to non-JS code)

These directives contain Java code which would be copied into the JavaScript parser/lexer code and would fail while parser/lexer execution (JavaScript parse error). Attention: @members code of grammars needs to be ported to JavaScript.

nodejs-parser-generator-based-on-antlr3's People

Contributors

kyr0 avatar

Watchers

James Cloos avatar Carsten Bleser Rasmussen 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.