CUP.Net

Simple LALR Parser Generator
CUP.Net

The CUP parser generator is a LALR grammar processing engine that produces fast and efficient parsing code.  Being very similar to YACC, CUP allows you to specify complex LALR grammars, and link to a custom lexicographic scanner. This product was based upon the popular CUP for Java parser and was migrated using the Microsoft Migration Assistant, with some custom modifications to fix bugs and make enhancements. This product is NOT open-source (for administrative purposes only), and is distributed using the LGPL license, just as the original CUP for Java.

Language Tuned for Humans

import System.Collections;
import CUP.runtime;

/* Terminals (tokens returned by the scanner). */
terminal           SEMI, PLUS, MINUS, TIMES, DIVIDE, MOD;
terminal           UMINUS, LPAREN, RPAREN, COMMA, ROUND;
terminal           AND, OR, EQ, NEQ, LT_EQ, LT, GT_EQ, GT;
terminal           NEGATE;
terminal int       INTEGER;
terminal double    REAL;
terminal string    FUNCTION, LITERAL;

/* Non terminals */
non terminal Formula expr_part;
non terminal ArrayList param_list;
non terminal Formula  expr;

/* Precedences */
precedence left EQ, NEQ, LT_EQ, LT, GT_EQ, GT;
precedence left ROUND;
precedence left PLUS, MINUS, OR, NEGATE;
precedence left TIMES, DIVIDE, MOD, AND;
precedence left UMINUS, LPAREN, RPAREN;

/* The grammar */
expr_part ::= expr:e SEMI
	        {: RESULT = e;
            :} 
            | error
	        ;

                        

This is also a command-line tool that is standalone. There is no integration with Visual Studio .NET planned at this time (what a great open-source project idea!)

Highly Capable and Extensible

  • RTFM: Web Manual
  • Light-weight LALR parsing engine
  • Create your own tokenizer to feed into an AI
  • Requires Microsoft's .NET platform

CUP.Net Licensing

This is free software that you can download from here as an MSI installer or from github. The installer includes the source code.