#!/bin/bash

echo "Running fire-lexer example ..."

target="maximalMunch.fire"
src="./compiler-src"
expected="FUNCTION INT ID(main) ASSN LPAREN RPAREN FATARROW LBRACE INT ID(fav) ASSN LIT(42) SEMI RETURN ID(fav) SEMI RBRACE "

echo > simple.lexed.ir

$src/fire.native -c < $target > $target.ll
llc -relocation-model=pic $target.ll > $target.s
gcc -g -o $target.flames $target.s $src/printlib.o $src/regexlib.o $src/arrlib.o $src/filelib.o $src/util.o

./$target.flames

echo -e "Expected output\t${expected}"
echo -e "Actual output\t`cat simple.lexed.ir`"
echo > simple.lexed.ir
