#!/bin/bash

case $1 in
    (clean)
        rm -rf scanner/lex.cc scanner/scannerbase.h \
               calculator parser/parse.*
    ;;
    (demo)
        cd parser
        bisonc++ grammar
        cd ../scanner
        flexc++ lexer
        cd ..
        g++ -Wall -o calculator *.cc */*.cc
    ;;
    (*)
        echo "$0 [clean|demo] to clean or build the demo program"
    ;;
esac
