comp520 / TinyLang

Simple expression language as introduction to compiler tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TinyLang

TinyLang is a simple expression language designed to introduce students to scanning and parsing tools. It supports integer literals, identifiers, binary operations (+-*/) and parentheticals. Example expressions supported by TinyLang:

1+2
1-2
2*3
6/3
1+2-3
1+2*3
1-2+3
2/2-3
3*(2+2)
1+2-(3-4)
2*3+(2/2)
2-(2+4)/2
2*(2+4)-1
2*(2+4)/2

TinyLang also implements a basic evaluation engine for computing the result. Note that evaluation is not supported in the presence of identifiers.

We provide 3 sample implementations of the scanner and paser:

  • flex+bison
  • SableCC 2
  • SableCC 3 (CST to AST conversion)

flex+bison works by default on the SOCS Trottier machines, whereas SableCC requires following the setup instructions here

About

Simple expression language as introduction to compiler tools


Languages

Language:Java 91.4%Language:C 5.6%Language:Yacc 0.9%Language:Makefile 0.9%Language:Lex 0.6%Language:Shell 0.4%Language:C++ 0.2%