-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.sh
More file actions
executable file
·35 lines (27 loc) · 1000 Bytes
/
codegen.sh
File metadata and controls
executable file
·35 lines (27 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
OCAML_CODE_LOC="./Extend/src/main"
OCAML_FILES="scanner.mll parser.mly ast.ml transform.ml semant.ml codeGenTypes.ml codegen.ml linker.ml main.ml"
C_CODE_LOC="./Extend/src/stdlib"
C_FILES="lib.c runtime.c"
EXTEND_STDLIB_CODE_LOC="./Extend/src/stdlib"
EXTEND_FILE="stdlib.xtnd"
TEX_FILE="tex/code.tex"
rm $TEX_FILE
touch $TEX_FILE
echo "\chapter{Extend Code Listing}" >> $TEX_FILE
for filename in $OCAML_FILES; do
echo "\section{$filename}" >> $TEX_FILE
echo "\begin{lstlisting}{ocaml}" >> $TEX_FILE
cat $OCAML_CODE_LOC/$filename >> $TEX_FILE
echo "\end{lstlisting}" >> $TEX_FILE
done
for filename in $C_FILES; do
echo "\section{$filename}" >> $TEX_FILE
echo "\begin{lstlisting}{c}" >> $TEX_FILE
cat $C_CODE_LOC/$filename >> $TEX_FILE
echo "\end{lstlisting}" >> $TEX_FILE
done
echo "\section{stdlib.xtnd}" >> $TEX_FILE
echo "\begin{lstlisting}" >> $TEX_FILE
cat $EXTEND_STDLIB_CODE_LOC/$EXTEND_FILE >> $TEX_FILE
echo "\end{lstlisting}" >> $TEX_FILE