Implement add + sub and minimal interpreter
This commit is contained in:
parent
667597d38e
commit
3654552d89
855
bootstrap/main.c
855
bootstrap/main.c
File diff suppressed because it is too large
Load Diff
4
debug.sh
4
debug.sh
@ -15,7 +15,7 @@ exe_name="nest"
|
||||
exe_path=$build_dir/$exe_name
|
||||
debug_flags="-g"
|
||||
optimization_flags="-O0"
|
||||
bootstrap_args="$path"
|
||||
bootstrap_args="$path i"
|
||||
case "$OSTYPE" in
|
||||
darwin*) static=0;;
|
||||
linux*) static=1;;
|
||||
@ -26,6 +26,6 @@ compile $build_dir $exe_name $debug_flags $optimization_flags $static
|
||||
|
||||
case "$OSTYPE" in
|
||||
darwin*) lldb -- $exe_path $bootstrap_args;;
|
||||
linux*) gf2 -ex b entry_point -ex r --args $exe_path $bootstrap_args;;
|
||||
linux*) gf2 -ex "set auto-solib-add off" -ex "r" --args $exe_path $bootstrap_args;;
|
||||
*) echo "unknown: $OSTYPE" ;;
|
||||
esac
|
||||
|
34
run_tests.sh
34
run_tests.sh
@ -8,7 +8,7 @@ build_dir="build"
|
||||
base_exe_name="nest"
|
||||
debug_flags="-g"
|
||||
no_optimization_flags=""
|
||||
test_names="first"
|
||||
test_names=("first" "add_sub")
|
||||
|
||||
if [ "$all" == "1" ]
|
||||
then
|
||||
@ -18,6 +18,7 @@ then
|
||||
linux*) linking_modes=("0" "1") ;;
|
||||
*) echo "unknown: $OSTYPE"; exit 1 ;;
|
||||
esac
|
||||
execution_engines=("c", "i")
|
||||
else
|
||||
optimization_modes=("-O0")
|
||||
case "$OSTYPE" in
|
||||
@ -25,13 +26,13 @@ else
|
||||
linux*) linking_modes=("1") ;;
|
||||
*) echo "unknown: $OSTYPE"; exit 1 ;;
|
||||
esac
|
||||
execution_engines=("i")
|
||||
fi
|
||||
|
||||
for linking_mode in "${linking_modes[@]}"
|
||||
do
|
||||
for optimization_mode in "${optimization_modes[@]}"
|
||||
do
|
||||
|
||||
printf "\n===========================\n"
|
||||
echo "TESTS (STATIC=$linking_mode, $optimization_mode)"
|
||||
printf "===========================\n\n"
|
||||
@ -48,16 +49,25 @@ do
|
||||
printf "\n===========================\n"
|
||||
echo "$test_name..."
|
||||
printf "===========================\n\n"
|
||||
cmd="build/$exe_name tests/$test_name.nat"
|
||||
echo "Run command: $cmd"
|
||||
eval "$cmd"
|
||||
printf "\n===========================\n"
|
||||
echo "$test_name [COMPILATION] [OK]"
|
||||
printf "===========================\n\n"
|
||||
nest/$test_name
|
||||
printf "\n===========================\n"
|
||||
echo "$test_name [RUN] [OK]"
|
||||
printf "===========================\n\n"
|
||||
|
||||
for execution_engine in "${execution_engines[@]}"
|
||||
do
|
||||
cmd="build/$exe_name tests/$test_name.nat $execution_engine"
|
||||
echo "Run command: $cmd"
|
||||
eval "$cmd"
|
||||
printf "\n===========================\n"
|
||||
echo "$test_name [COMPILATION] [EXECUTION ENGINE: $execution_engine] [OK]"
|
||||
printf "===========================\n\n"
|
||||
|
||||
if [ "$execution_engine" != "i" ]
|
||||
then
|
||||
nest/$test_name
|
||||
fi
|
||||
|
||||
printf "\n===========================\n"
|
||||
echo "$test_name [RUN] [OK]"
|
||||
printf "===========================\n\n"
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
|
4
tests/add_sub.nat
Normal file
4
tests/add_sub.nat
Normal file
@ -0,0 +1,4 @@
|
||||
fn main() s32
|
||||
{
|
||||
return 1 - 1 + 1 - 1;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user