npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

antlr4-vensim

v0.6.3

Published

Vensim grammar built in ANTLR 4

Downloads

134

Readme

antlr4-vensim Vensim grammar in ANTLR 4

Using the parser

Install Node 14 or later. ANTLR 4 now requires Node 14+ for ES module support.

Install the package with npm in your project.

npm install antlr4-vensim

Import the lexer, parser, and/or visitor.

import { ModelLexer, ModelParser, ModelVisitor } from 'antlr4-vensim'

Refer to the ANTLR 4 JavaScript runtime documentation for further details about using the parser.

Installing tools

The grammar development tools in this package require macOS. They are not required to use the parser.

Vensim grammar development uses the ANTLR 4 parser generator.

Install Node 14 or later. ANTLR 4 now requires Node 14+ for ES module support.

Install the latest Java SE JDK. We are only using Java for development purposes, which is covered by the license for Java SE.

Install ANTLR 4 Java tools version 4.12.0.

cd /usr/local/lib
sudo curl -O https://www.antlr.org/download/antlr-4.12.0-complete.jar

Set up ANTLR 4 in .bash_profile.

export CLASSPATH=".:/usr/local/lib/antlr-4.12.0-complete.jar:$CLASSPATH"

Developing the parser

Build the parser after modifying the grammar.

pnpm i
pnpm build

The build process generates a Vensim parser in JavaScript in the parser directory.

ModelLexer.js
ModelParser.js
ModelVisitor.js

Command line utility

The a4 script generates and runs a lexer and parser in Java. It is useful in development when you are trying to understand how the lexer is tokenizing your model and what parse tree the parser is generating.

generate

./a4 generate

Generate the parser in Java (not JavaScript) in the java directory.

lex

./a4 lex <mdl-file-pathname>

Run the lexer on the .mdl file to print the token stream. The generate command must be run first.

tree

./a4 tree <mdl-file-pathname>

Run the parser on the .mdl file to print the parse tree. The generate command must be run first.

clean

./a4 clean

Clean out the generated parser files in the java directory.

tokens

./a4 tokens

Print the lexer token list.