Download this repository -> compiler-lab (move it to home folder)
$sudo apt-get update
$sudo apt-get install byacc flex
$cd ~ && git clone https://github.com/prabhakaran9397/compiler-lab/
$cp ~/compiler-lab/mkl ~/.mkl; cp ~/compiler-lab/mky ~/.mky
$echo 'alias mkl="make -f ~/.mkl"' >> ~/.*shrc
$echo 'alias mky="make -f ~/.mky"' >> ~/.*shrc
$source ~/.*shrc
$cd ~/compiler-lab/codes && ls
count.l hello.c
$mkl count
lex -o count.c count.l
gcc -o count count.c -ll
rm count.c
$./count
hello
This is a test
:)
<press control+d>
Number of chars: 24
Number of lines: 3
$cat hello.c | ./count
Number of chars: 77
Number of lines: 7