Skip to content

Lexical analysis and parsing of fantastic programming language PTUC. Source-to-source compiler (trans-compiler or transpiler). Build with flex (lexical analysis) and bison(parsing).

Notifications You must be signed in to change notification settings

stisko/PTUC-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions for runnng the example
------------------------------------


1) Create a new directory and change into it

% mkdir  ptuc_example
% cd ptuc_example

2) Copy the .tar file in there and unpack it

% cp <download-dir/ptuc_example.tgz .
% tar xzvf ptuc_example.tgz

3) Build it

% touch .depend
% make
gcc -Wall -D_GNU_SOURCE -std=c11 -g   -I.    -c -o ptucc_scan.o ptucc_scan.c
bison -d ptucc_parser.y
flex -o ptucc_lex.c ptucc_lex.l
gcc -Wall -D_GNU_SOURCE -std=c11 -g   -I.    -c -o ptucc_lex.o ptucc_lex.c
gcc -Wall -D_GNU_SOURCE -std=c11 -g   -I.    -c -o ptucc_parser.tab.o ptucc_parser.tab.c
gcc -Wall -D_GNU_SOURCE -std=c11 -g   -I.    -c -o cgen.o cgen.c
gcc -Wall -D_GNU_SOURCE -std=c11 -g   -I.  -o ptucc_scan ptucc_scan.o ptucc_lex.o ptucc_parser.tab.o cgen.o -lfl
gcc -Wall -D_GNU_SOURCE -std=c11 -g   -I.    -c -o ptucc.o ptucc.c
gcc -Wall -D_GNU_SOURCE -std=c11 -g   -I.  -o ptucc ptucc.o ptucc_lex.o ptucc_parser.tab.o cgen.o -lfl

4) If it built correctly, try the test

% make test
./ptucc < sample001.ptuc > sample001.c
gcc -Wall -std=c11 -o sample001 sample001.c
./sample001
Hello world


5) Have a good study !!

About

Lexical analysis and parsing of fantastic programming language PTUC. Source-to-source compiler (trans-compiler or transpiler). Build with flex (lexical analysis) and bison(parsing).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published