Skip to content
/ Mu Public
forked from bkiers/Mu

A small demonstration how to use ANTLR 4's visitor feature.

Notifications You must be signed in to change notification settings

thaichat04/Mu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mu

A small expression parser, using ANTLR 4. It supports most basic operators and for-, while- and log- (print) statements. It is just a basic demonstration of how to use the -visitor functionality of ANTLR 4.

To run the demo script:

n = 9;

while n > 0 {

  # expressions can be surrounded by parenthesis, of course
  if (n % 2 == 0) {
    log n + " -> even";
  }
  else {
    log n + " -> odd";
  }

  n = n - 1;
}

do:

git clone git://github.com/bkiers/Mu.git
mvn clean install
mvn -q exec:java

which will print the following to your console:

9.0 -> odd
8.0 -> even
7.0 -> odd
6.0 -> even
5.0 -> odd
4.0 -> even
3.0 -> odd
2.0 -> even
1.0 -> odd

Also see this stackoverflow Q&A.

About

A small demonstration how to use ANTLR 4's visitor feature.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 82.4%
  • ANTLR 15.9%
  • mupad 1.7%