36
Makefile
36
Makefile
@ -12,11 +12,6 @@ YACC := src/grammar.y
|
||||
EXE := alpha
|
||||
|
||||
OBJS := tmp/runner.o tmp/symbol_table.o tmp/grammar.tab.o tmp/lex.yy.o tmp/intermediate_code.o tmp/codegen.o
|
||||
|
||||
TESTS-S1 := $(wildcard tests/sprint1/test/*.alpha)
|
||||
TESTS-S2 := $(wildcard tests/sprint2/test/*.alpha)
|
||||
TESTS-S3 := $(wildcard tests/sprint3/test/*.alpha)
|
||||
TESTS-S4 := $(wildcard tests/sprint4/test/*.alpha)
|
||||
# ----------
|
||||
|
||||
|
||||
@ -71,35 +66,30 @@ tmp/runner.o: src/runner.c src/runner.h tmp/flex.h tmp/grammar.tab.h
|
||||
|
||||
# ----- Tests -----
|
||||
test:
|
||||
chmod +x ./check.sh
|
||||
chmod +x ./test.sh
|
||||
$(foreach test, $(TESTS-S1), (./$(EXE) -tok -debug $(test) || true);)
|
||||
./test.sh sp2
|
||||
./test.sh sp3
|
||||
./test.sh sp4
|
||||
./check.sh
|
||||
./test.sh tests/sprint1/test/ -diff
|
||||
./test.sh tests/sprint2/test/ -diff
|
||||
./test.sh tests/sprint3/test/ -diff
|
||||
./test.sh tests/sprint4/test/ -diff
|
||||
./test.sh tests/given/test/ -diff
|
||||
|
||||
test-s1:
|
||||
chmod +x ./check.sh
|
||||
chmod +x ./test.sh
|
||||
$(foreach test, $(TESTS-S1), (./$(EXE) -tok -debug $(test) || true);)
|
||||
./check.sh sp1
|
||||
./test.sh tests/sprint1/test/ -diff
|
||||
|
||||
test-s2:
|
||||
chmod +x ./check.sh
|
||||
chmod +x ./test.sh
|
||||
./test.sh sp2
|
||||
./check.sh sp2
|
||||
./test.sh tests/sprint2/test/ -diff
|
||||
|
||||
test-s3:
|
||||
chmod +x ./check.sh
|
||||
chmod +x ./test.sh
|
||||
./test.sh sp3
|
||||
./check.sh sp3
|
||||
./test.sh tests/sprint3/test/ -diff
|
||||
|
||||
test-s4:
|
||||
chmod +x ./check.sh
|
||||
chmod +x ./test.sh
|
||||
./test.sh sp4
|
||||
./check.sh sp4
|
||||
./test.sh tests/sprint4/test/ -diff
|
||||
|
||||
test-given:
|
||||
chmod +x ./test.sh
|
||||
./test.sh tests/given/test/ -diff
|
||||
# -----------
|
67
check.sh
67
check.sh
@ -1,67 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Diff-Check Tool #
|
||||
# Checks if outputed TOK = exp #
|
||||
# The Translators - Spring 2025 #
|
||||
|
||||
TOK_DIR="out"
|
||||
NOCOLOR='\033[0m'
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
ORANGE='\033[0;33m'
|
||||
BLUE='\033[0;34m'
|
||||
PURPLE='\033[0;35m'
|
||||
CYAN='\033[0;36m'
|
||||
LIGHTGRAY='\033[0;37m'
|
||||
DARKGRAY='\033[1;30m'
|
||||
LIGHTRED='\033[1;31m'
|
||||
LIGHTGREEN='\033[1;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
LIGHTBLUE='\033[1;34m'
|
||||
LIGHTPURPLE='\033[1;35m'
|
||||
LIGHTCYAN='\033[1;36m'
|
||||
WHITE='\033[1;37m'
|
||||
|
||||
compare_files() {
|
||||
local file="$1"
|
||||
local filename=$(basename -- "$file")
|
||||
filename="${filename%.*}"
|
||||
local num=${filename:2:1}
|
||||
local exp="./tests/sprint$num/expected/$filename.expected"
|
||||
|
||||
if [[ -f "$exp" ]]; then
|
||||
diff -q "$file" "$exp" > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo -e "${GREEN}[✔] ${PURPLE}$filename ${WHITE}passed.${NOCOLOR}"
|
||||
elif [[ ! -s "$file" ]]; then
|
||||
echo -e "${RED}[✘] ${PURPLE}$filename ${WHITE}failed with an empty file. (did it segfault?)${NOCOLOR}"
|
||||
else
|
||||
echo -e "\n${RED}[✘] ${PURPLE}$file ${WHITE}failed with an unexpected value...${NOCOLOR}"
|
||||
diff --color=always "$file" "$exp"
|
||||
echo -e ""
|
||||
fi
|
||||
else
|
||||
echo -e "${ORANGE}[-] ${PURPLE}$filename ${WHITE}does not have an expected value.${NOCOLOR}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ ! -d "$TOK_DIR" ]]; then
|
||||
echo -e "${RED}[ERROR] ${YELLOW}Directory $TOK_DIR does not exist.${NOCOLOR}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
for file in "$TOK_DIR"/*; do
|
||||
compare_files "$file"
|
||||
done
|
||||
elif [[ $# -eq 1 ]]; then
|
||||
prefix="$1"
|
||||
for file in "$TOK_DIR"/"$prefix"*; do
|
||||
if [[ -f "$file" ]]; then
|
||||
compare_files "$file"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e "${LIGHTBLUE}Usage: $0 [sp#]${NOCOLOR}"
|
||||
exit 1
|
||||
fi
|
@ -116,6 +116,18 @@ int getPrimSize(TableNode *definition) {
|
||||
"Invalid.");
|
||||
return -1;
|
||||
}
|
||||
if(getAdInfoType(definition) == TYPE_ARRAY_TYPE){
|
||||
//special case to return size for reference to an array
|
||||
return 8;
|
||||
}
|
||||
if(getAdInfoType(definition) == TYPE_FUNCTION_TYPE){
|
||||
//special case to return size for reference to a function
|
||||
return 8;
|
||||
}
|
||||
if(getAdInfoType(definition) == TYPE_RECORD_TYPE){
|
||||
//special case to return size for reference to a record
|
||||
return getRecTotal(definition);
|
||||
}
|
||||
if (definition->additionalinfo == NULL) {
|
||||
printdebug("node has NULL additionalinfo. Invalid.");
|
||||
return -1;
|
||||
@ -1200,6 +1212,14 @@ TableNode *table_lookup(SymbolTable *table, char *x) {
|
||||
}
|
||||
TableNode *entrie = table->entries;
|
||||
for (; entrie != NULL; entrie = entrie->next) {
|
||||
if (entrie->theName == NULL) {
|
||||
printdebug("name of entry is currently NULL, undefined");
|
||||
return undefined;
|
||||
}
|
||||
if (entrie->theName == undefined->theName) {
|
||||
printdebug("name of entry is currently undefined");
|
||||
return undefined;
|
||||
}
|
||||
if (!strcmp(entrie->theName, x)) {
|
||||
return entrie;
|
||||
}
|
||||
|
251
test.sh
251
test.sh
@ -20,147 +20,140 @@ LIGHTCYAN='\033[1;36m'
|
||||
WHITE='\033[1;37m'
|
||||
|
||||
if [ ! -f "./alpha" ]; then
|
||||
echo -e "${RED}[ERROR] ${YELLOW}File ./alpha not found!${WHITE}"
|
||||
exit 1
|
||||
echo -e "${RED}[ALERT] ${YELLOW}File ./alpha not found! Generating with 'make'.${WHITE}"
|
||||
make
|
||||
fi
|
||||
|
||||
if [ ! -d "./out" ]; then
|
||||
mkdir -p out
|
||||
fi
|
||||
|
||||
SWITCH=${YELLOW}
|
||||
count=0
|
||||
if [ $# -eq 0 ]; then
|
||||
help
|
||||
fi
|
||||
|
||||
switchfunc() {
|
||||
if [ $count -eq 0 ]; then
|
||||
count=1
|
||||
SWITCH=${YELLOW}
|
||||
else
|
||||
count=0
|
||||
SWITCH='\033[0;35m'
|
||||
fi
|
||||
help() {
|
||||
echo -e "${WHITE}-----{ ${BLUE}Test.sh Help ${WHITE}}-----\n"
|
||||
echo -e "${YELLOW} Arguments: ${WHITE}"
|
||||
echo -e "${GREEN} -exp ${WHITE} Generate expected output files"
|
||||
echo -e "${GREEN} -diff ${WHITE} Compare output files with expected output files"
|
||||
echo -e "${GREEN} -help ${WHITE} Show this help message\n"
|
||||
echo -e "${YELLOW} Usage: ${WHITE}"
|
||||
echo -e "${GREEN} ./test.sh <file.alpha> [flags] ${WHITE} Run the test on a single file"
|
||||
echo -e "${GREEN} ./test.sh <directory> [flags] ${WHITE} Run the test on all files in a directory\n"
|
||||
echo -e "${YELLOW} Examples: ${WHITE}"
|
||||
echo -e "${GREEN} ./test.sh test.alpha ${WHITE} Runs test flags in header on test.alpha"
|
||||
echo -e "${GREEN} ./test.sh test/ ${WHITE} Runs test flags in header on all .alpha files in test/"
|
||||
echo -e "${GREEN} ./test.sh test/ -exp ${WHITE} Runs test flags in header on all .alpha files in test/ and generates expected output files"
|
||||
echo -e "${GREEN} ./test.sh test/ -diff ${WHITE} Runs test flags in header on all .alpha files in test/ and compares output files with expected output files"
|
||||
echo -e "${GREEN} ./test.sh test/ -exp -diff ${WHITE} Runs test flags in header on all .alpha files in test/ and generates expected output files and compares output files with expected output files\n"
|
||||
echo -e "${YELLOW} Notes: ${WHITE}"
|
||||
echo -e "${ORANGE} To create a test file, on the first line of the .alpha file, add:"
|
||||
echo -e "${LIGHTBLUE} (* TEST: [ <test_flags> ] *)"
|
||||
echo -e "${ORANGE} where <test_flags> are the alpha flags to be used. Ex:"
|
||||
echo -e "${LIGHTBLUE} (* TEST: [ -debug -asc -tc ] *)\n"
|
||||
echo -e "${WHITE}-----------------------------------------\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo -e "${YELLOW}[INFO] ${WHITE}Running all tests...${WHITE}"
|
||||
echo -e "${YELLOW}[INFO] ${ORANGE}Testing SPRINT-1 ---------------------------\n${WHITE}"
|
||||
for file in ./tests/sprint1/test/*; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename -- "$file")
|
||||
echo -e "- ${SWITCH}Running test: ${LIGHTBLUE}$filename ${SWITCH}-----${WHITE}"
|
||||
./alpha -st -debug "$file"
|
||||
echo -e "${SWITCH}----- End of test: ${LIGHTBLUE}$filename ${SWITCH}-${WHITE}\n"
|
||||
switchfunc
|
||||
fi
|
||||
done
|
||||
echo -e ""
|
||||
run() {
|
||||
filename=$(basename -- "$1")
|
||||
first_line=$(head -n 1 "$1")
|
||||
if [[ "$first_line" == "(* TEST: ["*"] *)"* ]]; then
|
||||
bracket_content=$(echo "$first_line" | sed -n 's/.*\[\(.*\)\].*/\1/p')
|
||||
sed -i '1d' "$1"
|
||||
./alpha ${bracket_content} "$1"
|
||||
sed -i "1s/^/$first_line\n/" "$1"
|
||||
|
||||
echo -e "${YELLOW}[INFO] ${ORANGE}Testing SPRINT-2 ---------------------------\n${WHITE}"
|
||||
for file in ./tests/sprint2/test/*; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename -- "$file")
|
||||
echo -e "- ${SWITCH}Running test: ${LIGHTBLUE}$filename ${SWITCH}-----${WHITE}"
|
||||
./alpha -st -debug "$file"
|
||||
echo -e "${SWITCH}----- End of test: ${LIGHTBLUE}$filename ${SWITCH}-${WHITE}\n"
|
||||
switchfunc
|
||||
fi
|
||||
done
|
||||
echo -e ""
|
||||
if [ $# -ge 2 ]; then
|
||||
path=$(dirname "$1")
|
||||
filename_noext=${filename:0:${#filename}-6}
|
||||
if [[ "$2" == "-exp" || "$3" == "-exp" ]]; then
|
||||
for file in out/${filename_noext}.*; do
|
||||
if [[ "$file" == *".asc" || "$file" == *".s" || "$file" == *".st" || "$file" == *".tok" || "$file" == *".ir" ]]; then
|
||||
for_filename=$(basename -- "$file")
|
||||
for_filename="${for_filename}.exp"
|
||||
if [ -f "${path}/../expected/${for_filename}" ]; then
|
||||
echo -e "${RED}[ALERT] ${YELLOW}File ${path}/../expected/${for_filename} already exists! Overwriting...${WHITE}"
|
||||
fi
|
||||
cp "$file" "${path}/../expected/${for_filename}"
|
||||
else
|
||||
echo -e "${RED}[ALERT] ${YELLOW}Unexpected file found: $file ${WHITE}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}[INFO] ${ORANGE}Testing SPRINT-3 ---------------------------\n${WHITE}"
|
||||
for file in ./tests/sprint3/test/*; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename -- "$file")
|
||||
echo -e "- ${SWITCH}Running test: ${LIGHTBLUE}$filename ${SWITCH}-----${WHITE}"
|
||||
./alpha -st -debug "$file"
|
||||
echo -e "${SWITCH}----- End of test: ${LIGHTBLUE}$filename ${SWITCH}-${WHITE}\n"
|
||||
switchfunc
|
||||
fi
|
||||
done
|
||||
echo -e ""
|
||||
if [[ "$2" == "-diff" || "$3" == "-diff" ]]; then
|
||||
for file in out/${filename_noext}.*; do
|
||||
if [[ "$file" == *".asc" || "$file" == *".s" || "$file" == *".st" || "$file" == *".tok" || "$file" == *".ir" ]]; then
|
||||
for_filename=$(basename -- "$file")
|
||||
for_filename="${for_filename}.exp"
|
||||
if [ -f "${path}/../expected/${for_filename}" ]; then
|
||||
exp_basename=$(basename -- "$for_filename")
|
||||
diff -q "${path}/../expected/${for_filename}" "$file"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}[SUCCESS] ${YELLOW}Test ${WHITE}$file ${YELLOW}passed ${WHITE}$exp_basename${WHITE}"
|
||||
else
|
||||
echo -e "${RED}[ERROR] ${YELLOW}Test ${WHITE}$file ${YELLOW}failed ${WHITE}$exp_basename${WHITE}"
|
||||
fi
|
||||
else
|
||||
echo -e "${RED}[ALERT] ${YELLOW}File ${path}/../expected/${for_filename} not found!${WHITE}"
|
||||
fi
|
||||
else
|
||||
echo -e "${RED}[ALERT] ${YELLOW}Unexpected file found: $file ${WHITE}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -e "${RED}[ERROR] ${YELLOW}File $1 is not a valid .alpha test file!${WHITE}"
|
||||
fi
|
||||
}
|
||||
|
||||
echo -e "${YELLOW}[INFO] ${ORANGE}Testing SPRINT-4 ---------------------------\n${WHITE}"
|
||||
for file in ./tests/sprint4/test/*; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename -- "$file")
|
||||
echo -e "- ${SWITCH}Running test: ${LIGHTBLUE}$filename ${SWITCH}-----${WHITE}"
|
||||
./alpha -cg "$file"
|
||||
echo -e "${SWITCH}----- End of test: ${LIGHTBLUE}$filename ${SWITCH}-${WHITE}\n${WHITE}"
|
||||
switchfunc
|
||||
fi
|
||||
done
|
||||
|
||||
else
|
||||
if [ "$1" == "--help" ]; then
|
||||
echo -e "${YELLOW}[INFO] ${WHITE}Usage: ./test.sh [prefix]"
|
||||
echo -e "${YELLOW}[INFO] ${WHITE}--help: show this help message"
|
||||
echo -e "${YELLOW}[INFO] ${WHITE}--file <file>: run test with file"
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$1" == "--file" ]]; then
|
||||
shift
|
||||
if [ $# -eq 0 ]; then
|
||||
echo -e "${RED}[ERROR] ${YELLOW}No file specified!${WHITE}"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f "$1" ]; then
|
||||
filename=$(basename -- "$1")
|
||||
echo -e "- ${SWITCH}Running test: ${LIGHTBLUE}$filename ${SWITCH}-----${WHITE}"
|
||||
./alpha -st -debug "$1"
|
||||
echo -e "${SWITCH}----- End of test: ${LIGHTBLUE}$filename ${SWITCH}-${WHITE}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${RED}[ERROR] ${YELLOW}File $1 not found!${WHITE}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$1" == "sp1" ]]; then
|
||||
echo -e "${YELLOW}[INFO] ${WHITE}Running tests with prefix $1..."
|
||||
for file in ./tests/sprint1/test/*; do
|
||||
if [[ "$file" == *"$1"* ]]; then
|
||||
filename=$(basename -- "$file")
|
||||
echo -e "- ${SWITCH}Running test: ${LIGHTBLUE}$filename ${SWITCH}-----${WHITE}"
|
||||
./alpha -st -debug "$file"
|
||||
echo -e "${SWITCH}----- End of test: ${LIGHTBLUE}$filename ${SWITCH}-${WHITE}\n"
|
||||
switchfunc
|
||||
fi
|
||||
done
|
||||
elif [[ "$1" == "sp2" ]]; then
|
||||
echo -e "${YELLOW}[INFO] ${WHITE}Running tests with prefix $1..."
|
||||
for file in ./tests/sprint2/test/*; do
|
||||
if [[ "$file" == *"$1"* ]]; then
|
||||
filename=$(basename -- "$file")
|
||||
echo -e "- ${SWITCH}Running test: ${LIGHTBLUE}$filename ${SWITCH}-----${WHITE}"
|
||||
./alpha -st -debug "$file"
|
||||
echo -e "${SWITCH}----- End of test: ${LIGHTBLUE}$filename ${SWITCH}-${WHITE}\n"
|
||||
switchfunc
|
||||
fi
|
||||
done
|
||||
elif [[ "$1" == "sp3" ]]; then
|
||||
echo -e "${YELLOW}[INFO] ${WHITE}Running tests with prefix $1..."
|
||||
for file in ./tests/sprint3/test/*; do
|
||||
if [[ "$file" == *"$1"* ]]; then
|
||||
filename=$(basename -- "$file")
|
||||
echo -e "- ${SWITCH}Running test: ${LIGHTBLUE}$filename ${SWITCH}-----${WHITE}"
|
||||
./alpha -st -debug "$file"
|
||||
echo -e "${SWITCH}----- End of test: ${LIGHTBLUE}$filename ${SWITCH}-${WHITE}\n"
|
||||
switchfunc
|
||||
fi
|
||||
done
|
||||
elif [[ "$1" == "sp4" ]]; then
|
||||
echo -e "${YELLOW}[INFO] ${WHITE}Running tests with prefix $1..."
|
||||
for file in ./tests/sprint4/test/*; do
|
||||
if [[ "$file" == *"$1"* ]]; then
|
||||
filename=$(basename -- "$file")
|
||||
echo -e "- ${SWITCH}Running test: ${LIGHTBLUE}$filename ${SWITCH}-----${WHITE}"
|
||||
./alpha -cg -debug "$file"
|
||||
echo -e "${SWITCH}----- End of test: ${LIGHTBLUE}$filename ${SWITCH}-${WHITE}\n"
|
||||
switchfunc
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e "${RED}[ERROR] ${YELLOW}Invalid prefix $1!${WHITE}"
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$1" == *"/" ]]; then
|
||||
if [ $# -ge 2 ]; then
|
||||
for file in "$1"*; do
|
||||
if [[ "$file" == *.alpha ]]; then
|
||||
if [[ "$2" == "-exp" || "$3" == "-exp" || "$2" == "-diff" || "$3" == "-diff" ]]; then
|
||||
run "$file" "$2" "$3"
|
||||
else
|
||||
echo -e "${RED}[ERROR] ${YELLOW}Invalid argument $2!${WHITE}"
|
||||
help
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
for file in "$1"*; do
|
||||
if [[ "$file" == *.alpha ]]; then
|
||||
run "$file"
|
||||
else
|
||||
echo -e "${RED}[ERROR] ${YELLOW}File $file is not a .alpha file!${WHITE}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
if [[ "$1" == *.alpha ]]; then
|
||||
if [ $# -ge 2 ]; then
|
||||
if [[ "$2" == "-exp" || "$3" == "-exp" || "$2" == "-diff" || "$3" == "-diff" ]]; then
|
||||
run "$1" "$2" "$3"
|
||||
else
|
||||
echo -e "${RED}[ERROR] ${YELLOW}Invalid argument $2!${WHITE}"
|
||||
help
|
||||
fi
|
||||
else
|
||||
run "$1"
|
||||
|
||||
fi
|
||||
else
|
||||
echo -e "${RED}[ERROR] ${YELLOW}File $1 is not a .alpha file!${WHITE}"
|
||||
help
|
||||
fi
|
||||
else
|
||||
help
|
||||
fi
|
||||
|
@ -1 +0,0 @@
|
||||
type A : 1 -> integer
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
(* type string : 1 -> character *)
|
||||
type M : string -> integer
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type M : string -> integer
|
||||
|
||||
function entry : M
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type M : string -> integer
|
||||
function entry : M
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type M : string -> integer
|
||||
|
||||
function entry : M
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type M : string -> integer
|
||||
|
||||
function foo : M
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type M : string -> integer
|
||||
|
||||
function entry : M
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type string2int: string -> integer
|
||||
|
||||
function entry : string2int
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type string2int: string -> integer
|
||||
|
||||
function entry : string2int
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type M : integer -> integer
|
||||
|
||||
function f : M
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type M : integer -> integer
|
||||
|
||||
function f : M
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
(* Type definitions *)
|
||||
|
||||
(* mapping type *)
|
||||
@ -28,7 +29,6 @@ function c: string2int_2_integer
|
||||
function d: iic2b
|
||||
|
||||
d(x,y,z) := {
|
||||
[string: s;integer: s]
|
||||
return (x < y & z < 'm');
|
||||
}
|
||||
|
||||
@ -57,11 +57,11 @@ c(x) := {
|
||||
entry is the first function called
|
||||
*)
|
||||
entry(arg) := {
|
||||
[integer: result; string2int: f; integer: temp; character: char]
|
||||
[integer: result; string2int: f; integer: temp]
|
||||
temp := a("Hello");
|
||||
f := b(temp);
|
||||
result := c(f);
|
||||
if (d(1,2,char))
|
||||
if (d(1,2,'c'))
|
||||
then {
|
||||
result := 0;
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
|
||||
(* Type definitions *)
|
||||
type int2int: integer -> integer
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
(* Type definitions *)
|
||||
|
||||
type string2int: string -> integer
|
||||
@ -45,9 +46,9 @@ selectionSort(data) := {
|
||||
data(i) := temp;
|
||||
i := i + 1;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
(* Function definition
|
||||
entry is the first function called
|
2
tests/given/test/type.array.alpha
Normal file
2
tests/given/test/type.array.alpha
Normal file
@ -0,0 +1,2 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type A : 1 -> integer
|
@ -1,2 +1,3 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type M : integer -> character
|
||||
|
@ -1 +1,2 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
type R : [ integer : i ; character : c ]
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-asc -tc] *)
|
||||
(*
|
||||
|
||||
At compiler start-up your program should
|
20
tests/sprint1/expected/sp1_simple_alpha.tok.exp
Normal file
20
tests/sprint1/expected/sp1_simple_alpha.tok.exp
Normal file
@ -0,0 +1,20 @@
|
||||
1 1 405 "type"
|
||||
1 6 101 "main"
|
||||
1 10 508 ":"
|
||||
1 12 101 "string"
|
||||
1 19 510 "->"
|
||||
1 22 201 "integer"
|
||||
2 1 406 "function"
|
||||
2 10 101 "entry"
|
||||
2 15 508 ":"
|
||||
2 17 101 "main"
|
||||
4 1 101 "entry"
|
||||
4 6 501 "("
|
||||
4 7 101 "arg"
|
||||
4 10 502 ")"
|
||||
4 12 608 ":="
|
||||
4 15 505 "{"
|
||||
5 5 407 "return"
|
||||
5 12 301 "0"
|
||||
5 13 507 ";"
|
||||
6 1 506 "}"
|
@ -1 +1,2 @@
|
||||
(* TEST: [-tok] *)
|
||||
(***)
|
@ -1 +1,2 @@
|
||||
(* TEST: [-tok] *)
|
||||
(*(**)*)
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
(*(**)*)
|
||||
(***)
|
||||
(******)(*\kpp*********)
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
(* hello *)
|
||||
(* hello *)
|
||||
(* I'd think this is a legal "string" that contains several \n \t
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
This is a test
|
||||
9combined 7okens
|
||||
12345
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
while
|
||||
While
|
||||
whiLe
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
+
|
||||
-
|
||||
*
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
;
|
||||
:
|
||||
,
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
)
|
||||
a)
|
||||
)a
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
type rec: [integer: x; integer: y]
|
||||
type T1: integer -> integer
|
||||
type T2: rec -> integer
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
(* Type definitions *)
|
||||
type string: 1 -> character
|
||||
type int2int: integer -> integer
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
type main: string -> integer
|
||||
function entry: main
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
45
|
||||
123
|
||||
8392
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
"this is a string" 721398 'g' '/n' (* should print 3 tokens before this *)
|
||||
'
|
||||
'
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-tok] *)
|
||||
valid1
|
||||
Valid2
|
||||
_valid3
|
||||
|
@ -1,27 +1,27 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
bar2 : 001001 : : undefined : Function Definition
|
||||
bar1 : 001001 : : undefined : Function Definition
|
||||
foo : 001001 : : undefined : Function Definition
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
arr : 001001 : : 1 -> integer : Type of Array
|
||||
T2 : 001001 : : rec -> integer : Type of Function
|
||||
T1 : 001001 : : integer -> integer : Type of Function
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
T1 : 001001 : : integer -> integer : Type of Function
|
||||
T2 : 001001 : : rec -> integer : Type of Function
|
||||
arr : 001001 : : 1 -> integer : Type of Array
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
entry : 001001 : : main : Function Definition that starts at line 25
|
||||
foo : 001001 : : T1 : Function Definition that starts at line 13
|
||||
bar1 : 001001 : : T2 : Function Definition that starts at line 17
|
||||
bar2 : 001001 : : T2 : Function Definition that starts at line 21
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
w : 025000 : 001001 : rec : Record Instance
|
||||
result : 025000 : 001001 : integer : Primitive Instance
|
||||
arg : 025000 : 001001 : string : Array Instance
|
||||
result : 025000 : 001001 : integer : Primitive Instance
|
||||
w : 025000 : 001001 : rec : Record Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
r : 021000 : 001001 : integer : Primitive Instance
|
||||
s : 021000 : 001001 : integer : Primitive Instance
|
||||
@ -31,5 +31,5 @@ y : 017000 : 001001 : integer
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
x : 013000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 001000 : 001001 : integer : Primitive Instance
|
||||
x : 001000 : 001001 : integer : Primitive Instance
|
||||
y : 001000 : 001001 : integer : Primitive Instance
|
@ -1,29 +1,29 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
integer2integer2integerFunc : 001001 : : undefined : Function Definition
|
||||
released : 001001 : : undefined : Function Definition
|
||||
reserved : 001001 : : undefined : Function Definition
|
||||
printBoolean : 001001 : : undefined : Function Definition
|
||||
printCharacter : 001001 : : undefined : Function Definition
|
||||
printInteger : 001001 : : undefined : Function Definition
|
||||
integer2integer2integer : 001001 : : integer2integer -> integer : Type of Function
|
||||
address2integer : 001001 : : address -> integer : Type of Function
|
||||
integer2address : 001001 : : integer -> address : Type of Function
|
||||
Boolean2Boolean2Boolean : 001001 : : Boolean2Boolean -> Boolean : Type of Function
|
||||
character2character2Boolean : 001001 : : undefined -> undefined : Type of Function
|
||||
integer2integer2Boolean : 001001 : : integer2integer -> Boolean : Type of Function
|
||||
string2integer : 001001 : : string -> integer : Type of Function
|
||||
Boolean2integer : 001001 : : Boolean -> integer : Type of Function
|
||||
character2integer : 001001 : : character -> integer : Type of Function
|
||||
integer2integer : 001001 : : integer -> integer : Type of Function
|
||||
Boolean2Boolean : 001001 : : Boolean -> Boolean : Type of Function
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
Boolean2Boolean : 001001 : : Boolean -> Boolean : Type of Function
|
||||
integer2integer : 001001 : : integer -> integer : Type of Function
|
||||
character2integer : 001001 : : character -> integer : Type of Function
|
||||
Boolean2integer : 001001 : : Boolean -> integer : Type of Function
|
||||
string2integer : 001001 : : string -> integer : Type of Function
|
||||
integer2integer2Boolean : 001001 : : integer2integer -> Boolean : Type of Function
|
||||
character2character2Boolean : 001001 : : undefined -> undefined : Type of Function
|
||||
Boolean2Boolean2Boolean : 001001 : : Boolean2Boolean -> Boolean : Type of Function
|
||||
integer2address : 001001 : : integer -> address : Type of Function
|
||||
address2integer : 001001 : : address -> integer : Type of Function
|
||||
integer2integer2integer : 001001 : : integer2integer -> integer : Type of Function
|
||||
printInteger : 001001 : : integer2integer : Function not defined before runtime
|
||||
printCharacter : 001001 : : character2integer : Function not defined before runtime
|
||||
printBoolean : 001001 : : Boolean2integer : Function not defined before runtime
|
||||
reserved : 001001 : : integer2address : Function not defined before runtime
|
||||
released : 001001 : : address2integer : Function not defined before runtime
|
||||
integer2integer2integerFunc : 001001 : : integer2integer2integer : Function not defined before runtime
|
||||
entry : 001001 : : string2integer : Function not defined before runtime
|
@ -1,21 +1,21 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
testarr : 001001 : : 1 -> integer : Type of Array
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
entry : 001001 : : main : Function Definition that starts at line 5
|
||||
testarr : 001001 : : 1 -> integer : Type of Array
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
b1 : 005000 : 001001 : Boolean : Primitive Instance
|
||||
b2 : 005000 : 001001 : Boolean : Primitive Instance
|
||||
arr2 : 005000 : 001001 : testarr : Array Instance
|
||||
arr : 005000 : 001001 : testarr : Array Instance
|
||||
x : 005000 : 001001 : integer : Primitive Instance
|
||||
arg : 005000 : 001001 : string : Array Instance
|
||||
x : 005000 : 001001 : integer : Primitive Instance
|
||||
arr : 005000 : 001001 : testarr : Array Instance
|
||||
arr2 : 005000 : 001001 : testarr : Array Instance
|
||||
b2 : 005000 : 001001 : Boolean : Primitive Instance
|
||||
b1 : 005000 : 001001 : Boolean : Primitive Instance
|
@ -1,20 +1,20 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
test : 001001 : : undefined : Function Definition
|
||||
main : 001001 : : rec -> integer : Type of Function
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
main : 001001 : : rec -> integer : Type of Function
|
||||
test : 001001 : : main : Function Definition that starts at line 5
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
arg : 005000 : 001001 : integer : Primitive Instance
|
||||
arg2 : 005000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 001000 : 001001 : integer : Primitive Instance
|
||||
x : 001000 : 001001 : integer : Primitive Instance
|
||||
y : 001000 : 001001 : integer : Primitive Instance
|
@ -1,20 +1,20 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
entry : 001001 : : main : Function Definition that starts at line 6
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
w : 006000 : 001001 : rec : Record Instance
|
||||
arg : 006000 : 001001 : string : Array Instance
|
||||
w : 006000 : 001001 : rec : Record Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 004000 : 001001 : integer : Primitive Instance
|
||||
x : 004000 : 001001 : integer : Primitive Instance
|
||||
y : 004000 : 001001 : integer : Primitive Instance
|
@ -1,17 +1,17 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
w : 003000 : 001001 : rec : Record Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 001000 : 001001 : integer : Primitive Instance
|
||||
x : 001000 : 001001 : integer : Primitive Instance
|
||||
y : 001000 : 001001 : integer : Primitive Instance
|
@ -1,39 +1,38 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
printBoolean : 001001 : : undefined : Function Definition
|
||||
printCharacter : 001001 : : undefined : Function Definition
|
||||
printInteger : 001001 : : undefined : Function Definition
|
||||
address2integer : 001001 : : address -> integer : Type of Function
|
||||
integer2address : 001001 : : integer -> address : Type of Function
|
||||
BooleanXBoolean2Boolean : 001001 : : BooleanXBoolean -> Boolean : Type of Function
|
||||
characterXcharacter2Boolean : 001001 : : characterXcharacter -> Boolean : Type of Function
|
||||
integerXinteger2Boolean : 001001 : : integerXinteger -> Boolean : Type of Function
|
||||
integerXinteger2integer : 001001 : : integerXinteger -> integer : Type of Function
|
||||
string2integer : 001001 : : string -> integer : Type of Function
|
||||
Boolean2integer : 001001 : : Boolean -> integer : Type of Function
|
||||
character2integer : 001001 : : character -> integer : Type of Function
|
||||
integer2integer : 001001 : : integer -> integer : Type of Function
|
||||
Boolean2Boolean : 001001 : : Boolean -> Boolean : Type of Function
|
||||
integerXinteger : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
characterXcharacter : 001001 : : Record Type : elements-2 size-2 bytes
|
||||
BooleanXBoolean : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
BooleanXBoolean : 001001 : : Record Type : elements-2 size-2 bytes
|
||||
characterXcharacter : 001001 : : Record Type : elements-2 size-2 bytes
|
||||
integerXinteger : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
Boolean2Boolean : 001001 : : Boolean -> Boolean : Type of Function
|
||||
integer2integer : 001001 : : integer -> integer : Type of Function
|
||||
character2integer : 001001 : : character -> integer : Type of Function
|
||||
Boolean2integer : 001001 : : Boolean -> integer : Type of Function
|
||||
string2integer : 001001 : : string -> integer : Type of Function
|
||||
integerXinteger2integer : 001001 : : integerXinteger -> integer : Type of Function
|
||||
integerXinteger2Boolean : 001001 : : integerXinteger -> Boolean : Type of Function
|
||||
characterXcharacter2Boolean : 001001 : : characterXcharacter -> Boolean : Type of Function
|
||||
BooleanXBoolean2Boolean : 001001 : : BooleanXBoolean -> Boolean : Type of Function
|
||||
integer2address : 001001 : : integer -> address : Type of Function
|
||||
address2integer : 001001 : : address -> integer : Type of Function
|
||||
printInteger : 001001 : : integer2integer : Function not defined before runtime
|
||||
printCharacter : 001001 : : character2integer : Function not defined before runtime
|
||||
printBoolean : 001001 : : Boolean2integer : Function not defined before runtime
|
||||
entry : 001001 : : string2integer : Function not defined before runtime
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 015000 : 001001 : integer : Primitive Instance
|
||||
x : 015000 : 001001 : integer : Primitive Instance
|
||||
y : 015000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 014000 : 001001 : character : Primitive Instance
|
||||
x : 014000 : 001001 : character : Primitive Instance
|
||||
y : 014000 : 001001 : character : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 013000 : 001001 : Boolean : Primitive Instance
|
||||
x : 013000 : 001001 : Boolean : Primitive Instance
|
||||
y : 013000 : 001001 : Boolean : Primitive Instance
|
58
tests/sprint2/expected/sp2_llnode.st.exp
Normal file
58
tests/sprint2/expected/sp2_llnode.st.exp
Normal file
@ -0,0 +1,58 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
entry : 001001 : : main : Function Definition that starts at line 68
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
T1 : 001001 : : integer -> integer : Type of Function
|
||||
T2 : 001001 : : rec -> integer : Type of Function
|
||||
llnode : 001001 : : Record Type : elements-3 size-24 bytes
|
||||
list : 001001 : : integer -> llnode : Type of Function
|
||||
foo : 001001 : : T1 : Function Definition that starts at line 45
|
||||
bar1 : 001001 : : T2 : Function Definition that starts at line 49
|
||||
bar2 : 001001 : : T2 : Function Definition that starts at line 53
|
||||
make_list : 001001 : : list : Function Definition that starts at line 16
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
arg : 068000 : 001001 : string : Array Instance
|
||||
result : 068000 : 001001 : integer : Primitive Instance
|
||||
w : 068000 : 001001 : rec : Record Instance
|
||||
li : 068000 : 001001 : llnode : Record Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
r : 053000 : 001001 : integer : Primitive Instance
|
||||
s : 053000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
x : 058012 : 053000 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
a : 049000 : 001001 : integer : Primitive Instance
|
||||
b : 049000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
x : 045000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
a : 016000 : 001001 : integer : Primitive Instance
|
||||
orig_a : 016000 : 001001 : integer : Primitive Instance
|
||||
ret : 016000 : 001001 : llnode : Record Instance
|
||||
curr : 016000 : 001001 : llnode : Record Instance
|
||||
temp : 016000 : 001001 : llnode : Record Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
prev : 008000 : 001001 : llnode : Record Instance
|
||||
val : 008000 : 001001 : integer : Primitive Instance
|
||||
next : 008000 : 001001 : llnode : Record Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
x : 004000 : 001001 : integer : Primitive Instance
|
||||
y : 004000 : 001001 : integer : Primitive Instance
|
@ -1,66 +1,58 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
make_list : 001001 : : undefined : Function Definition
|
||||
bar2 : 001001 : : undefined : Function Definition
|
||||
bar1 : 001001 : : undefined : Function Definition
|
||||
foo : 001001 : : undefined : Function Definition
|
||||
list : 001001 : : integer -> llnode : Type of Function
|
||||
llnode : 001001 : : Record Type : elements-3 size-24 bytes
|
||||
T2 : 001001 : : rec -> integer : Type of Function
|
||||
T1 : 001001 : : integer -> integer : Type of Function
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
entry : 001001 : : main : Function Definition that starts at line 69
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
T1 : 001001 : : integer -> integer : Type of Function
|
||||
T2 : 001001 : : rec -> integer : Type of Function
|
||||
llnode : 001001 : : Record Type : elements-3 size-24 bytes
|
||||
list : 001001 : : integer -> llnode : Type of Function
|
||||
foo : 001001 : : T1 : Function Definition that starts at line 46
|
||||
bar1 : 001001 : : T2 : Function Definition that starts at line 50
|
||||
bar2 : 001001 : : T2 : Function Definition that starts at line 54
|
||||
make_list : 001001 : : list : Function Definition that starts at line 16
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
li : 069000 : 001001 : llnode : Record Instance
|
||||
w : 069000 : 001001 : rec : Record Instance
|
||||
result : 069000 : 001001 : integer : Primitive Instance
|
||||
arg : 069000 : 001001 : string : Array Instance
|
||||
result : 069000 : 001001 : integer : Primitive Instance
|
||||
w : 069000 : 001001 : rec : Record Instance
|
||||
li : 069000 : 001001 : llnode : Record Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
r : 054000 : 001001 : integer : Primitive Instance
|
||||
s : 054000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
x : 059012 : 054000 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
: 062028 : 059012 : : Empty Scope
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
: 055021 : 054000 : : Empty Scope
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
: 056026 : 055021 : : Empty Scope
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
a : 050000 : 001001 : integer : Primitive Instance
|
||||
b : 050000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
x : 046000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
temp : 016000 : 001001 : address : Primitive Instance
|
||||
curr : 016000 : 001001 : address : Primitive Instance
|
||||
ret : 016000 : 001001 : address : Primitive Instance
|
||||
orig_a : 016000 : 001001 : integer : Primitive Instance
|
||||
a : 016000 : 001001 : integer : Primitive Instance
|
||||
orig_a : 016000 : 001001 : integer : Primitive Instance
|
||||
ret : 016000 : 001001 : llnode : Record Instance
|
||||
curr : 016000 : 001001 : llnode : Record Instance
|
||||
temp : 016000 : 001001 : llnode : Record Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
: 021012 : 016000 : : Empty Scope
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
: 026023 : 021012 : : Empty Scope
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
: 035020 : 026023 : : Empty Scope
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
: 031034 : 026023 : : Empty Scope
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
: 019029 : 016000 : : Empty Scope
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
next : 008000 : 001001 : llnode : Record Instance
|
||||
val : 008000 : 001001 : integer : Primitive Instance
|
||||
prev : 008000 : 001001 : llnode : Record Instance
|
||||
val : 008000 : 001001 : integer : Primitive Instance
|
||||
next : 008000 : 001001 : llnode : Record Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 004000 : 001001 : integer : Primitive Instance
|
||||
x : 004000 : 001001 : integer : Primitive Instance
|
||||
y : 004000 : 001001 : integer : Primitive Instance
|
@ -1,22 +1,22 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
bar2 : 001001 : : undefined : Function Definition
|
||||
bar1 : 001001 : : undefined : Function Definition
|
||||
foo : 001001 : : undefined : Function Definition
|
||||
T2 : 001001 : : rec -> integer : Type of Function
|
||||
T1 : 001001 : : integer -> integer : Type of Function
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
entry : 001001 : : main : Function not defined before runtime
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
T1 : 001001 : : integer -> integer : Type of Function
|
||||
T2 : 001001 : : rec -> integer : Type of Function
|
||||
foo : 001001 : : T1 : Function Definition that starts at line 1
|
||||
bar1 : 001001 : : T2 : Function Definition that starts at line 1
|
||||
bar2 : 001001 : : T2 : Function not defined before runtime
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
: 000000 : 001001 : : Empty Scope
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
@ -25,5 +25,5 @@ undefined : 001000 : 001001 : integer
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
x : 001000 : 001001 : integer : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 001000 : 001001 : integer : Primitive Instance
|
||||
x : 001000 : 001001 : integer : Primitive Instance
|
||||
y : 001000 : 001001 : integer : Primitive Instance
|
@ -1,23 +1,23 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
entry : 001001 : : main : Function Definition that starts at line 6
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
arg_bool : 006000 : 001001 : Boolean : Primitive Instance
|
||||
arg_record : 006000 : 001001 : rec : Record Instance
|
||||
arg_y : 006000 : 001001 : integer : Primitive Instance
|
||||
arg_x : 006000 : 001001 : integer : Primitive Instance
|
||||
arg : 006000 : 001001 : string : Array Instance
|
||||
arg_x : 006000 : 001001 : integer : Primitive Instance
|
||||
arg_y : 006000 : 001001 : integer : Primitive Instance
|
||||
arg_record : 006000 : 001001 : rec : Record Instance
|
||||
arg_bool : 006000 : 001001 : Boolean : Primitive Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
rec_y : 002000 : 001001 : integer : Primitive Instance
|
||||
rec_x : 002000 : 001001 : integer : Primitive Instance
|
||||
rec_y : 002000 : 001001 : integer : Primitive Instance
|
@ -1,16 +1,16 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
entry : 001001 : : main : Function Definition that starts at line 4
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
x : 004000 : 001001 : integer : Primitive Instance
|
||||
arg : 004000 : 001001 : string : Array Instance
|
||||
x : 004000 : 001001 : integer : Primitive Instance
|
@ -1,17 +1,16 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
a_of_s : 001001 : : 1 -> string : Type of Array
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
a_of_s : 001001 : : 1 -> string : Type of Array
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
many_names : 006000 : 001001 : a_of_s : Array Instance
|
||||
another_name : 006000 : 001001 : string : Array Instance
|
||||
one_name : 006000 : 001001 : string : Array Instance
|
||||
another_name : 006000 : 001001 : string : Array Instance
|
||||
many_names : 006000 : 001001 : a_of_s : Array Instance
|
@ -1,21 +0,0 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
T2 : 001001 : : rec -> integer : Type of Function
|
||||
rec : 001001 : : Record Type : elements-2 size-8 bytes
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
w : 007000 : 001001 : rec : Record Instance
|
||||
arg : 007000 : 001001 : string : Array Instance
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
y : 004000 : 001001 : integer : Primitive Instance
|
||||
x : 004000 : 001001 : integer : Primitive Instance
|
@ -1,19 +1,13 @@
|
||||
NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION :
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
entry : 001001 : : undefined : Function Definition
|
||||
main : 001001 : : string -> integer : Type of Function
|
||||
integer : 001001 : : Primitive Type : size-4 bytes
|
||||
address : 001001 : : Primitive Type : size-8 bytes
|
||||
character : 001001 : : Primitive Type : size-1 bytes
|
||||
string : 001001 : : 1 -> character : Type of Array
|
||||
Boolean : 001001 : : Primitive Type : size-4 bytes
|
||||
Boolean : 001001 : : Primitive Type : size-1 bytes
|
||||
reserve type : 001001 : : integer -> address : Type of Function
|
||||
reserve : 001001 : : undefined : Function Definition
|
||||
reserve : 001001 : : reserve type : Function not defined before runtime
|
||||
release type : 001001 : : address -> integer : Type of Function
|
||||
release : 001001 : : undefined : Function Definition
|
||||
release : 001001 : : release type : Function not defined before runtime
|
||||
------------------------------:--------:--------:-----------------------------------:-----------------------------------:
|
||||
bool : 015000 : 001001 : Boolean : Primitive Instance
|
||||
char : 015000 : 001001 : character : Primitive Instance
|
||||
add : 015000 : 001001 : address : Primitive Instance
|
||||
i : 015000 : 001001 : integer : Primitive Instance
|
||||
arg : 015000 : 001001 : string : Array Instance
|
||||
: 000000 : 001001 : : Empty Scope
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type rec: [integer: x; integer: y]
|
||||
|
||||
type T1: integer -> integer
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type Boolean2Boolean: Boolean -> Boolean
|
||||
type integer2integer: integer -> integer
|
||||
type character2integer: character -> integer
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type main: string -> integer
|
||||
function entry: main
|
||||
type testarr : 1 -> integer
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type rec: [integer: x; integer: y]
|
||||
type main: rec -> integer
|
||||
function test: main
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type main: string -> integer
|
||||
function entry: main
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type rec: [integer: x; integer: y]
|
||||
|
||||
entry (arg) := {
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
(*
|
||||
At compiler start-up your program should create symbol table entries for the four primitive types:
|
||||
Boolean (1 byte)
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type main: string -> integer
|
||||
function entry: main
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type main: string -> integer
|
||||
function entry: main
|
||||
|
||||
|
@ -1 +1,2 @@
|
||||
(* TEST: [-st] *)
|
||||
type main: string -> integer function entry: main type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer function foo : T1 function bar1 : T2 function bar2 : T2 foo(x) := { return x * x; } bar1(a) := { return a.x * a.y; } bar2 as (r,s) := { return r * s; } entry(arg) := { [ integer: result ; rec: w] result := foo(5); w := reserve w; w.x := 5; w.y := 7; result := bar1(w); result := bar2(5,7); return 0; }
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type main: string -> integer
|
||||
type rec: [integer: rec_x; integer: rec_y]
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type main: string -> integer
|
||||
function entry: main
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
(* TEST: [-st] *)
|
||||
type string: 1 -> character
|
||||
type a_of_s: 1 -> string
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
type string: 1 -> character
|
||||
type a_of_s: 1 -> string
|
||||
|
||||
(* maybe some other type definitions *)
|
||||
|
||||
entry(arg) := {
|
||||
[ string: one_name; string: another_name; a_of_s: many_names ]
|
||||
another_name := reserve another_name(4); (* reserve space for an an array of character, with 4 members *)
|
||||
many_names := reserve a_of_s(3);
|
||||
many_names(0) := one_name;
|
||||
many_names(1) := another_name;
|
||||
many_names(2) := reserve a_of_s(2)(6); (* reserve space for an item of the same type as a_of_s(2), an array of character, with 6 members *)
|
||||
many_names(2)(0) := "P";
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
type main: string -> integer
|
||||
(* TEST: [-st] *)
|
||||
ype main: string -> integer
|
||||
function entry: main
|
||||
|
||||
type rec: [integer: x; integer: y]
|
||||
|
92
tests/sprint3/expected/sp3_and_or_type_check.asc.exp
Normal file
92
tests/sprint3/expected/sp3_and_or_type_check.asc.exp
Normal file
@ -0,0 +1,92 @@
|
||||
001: type rec: [integer: x; integer: y]
|
||||
002: type main: rec -> integer
|
||||
003: function test: main
|
||||
004:
|
||||
005: test (arg) := {
|
||||
006: [integer:x; Boolean: b]
|
||||
007: while (true) {
|
||||
008: x := 0;
|
||||
LINE (8:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t1 of type integer
|
||||
LINE (8:9) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (8:3) ** TYPE ERROR: Undefined variable x
|
||||
009: }
|
||||
010:
|
||||
011: while (7) {
|
||||
012: x := 1;
|
||||
LINE (12:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t3 of type integer
|
||||
LINE (12:9) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (12:3) ** TYPE ERROR: Undefined variable x
|
||||
013: }
|
||||
014:
|
||||
015: if (true) then {
|
||||
016: x := 1;
|
||||
LINE (16:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t5 of type integer
|
||||
LINE (16:9) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (16:3) ** TYPE ERROR: Undefined variable x
|
||||
017: } else {
|
||||
018: x := 0;
|
||||
LINE (18:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t6 of type integer
|
||||
LINE (18:9) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (18:3) ** TYPE ERROR: Undefined variable x
|
||||
019: }
|
||||
020:
|
||||
021: if (x) then {
|
||||
LINE (21:6) ** TYPE ERROR: Undefined variable x
|
||||
022: x := 0;
|
||||
LINE (22:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t7 of type integer
|
||||
LINE (22:9) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (22:3) ** TYPE ERROR: Undefined variable x
|
||||
023: } else {
|
||||
024: x := 1;
|
||||
LINE (24:9) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t8 of type integer
|
||||
LINE (24:9) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (24:3) ** TYPE ERROR: Undefined variable x
|
||||
025: }
|
||||
026:
|
||||
027: b := b | b;
|
||||
LINE (27:12) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (27:12) ** TYPE ERROR: Object undefined of type undefined and Object undefined of type undefined must both be Boolean
|
||||
LINE (27:11) ** TYPE ERROR: Undefined variable b
|
||||
LINE (27:7) ** TYPE ERROR: Undefined variable b
|
||||
LINE (27:2) ** TYPE ERROR: Undefined variable b
|
||||
028: b := b & b;
|
||||
LINE (28:12) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (28:12) ** TYPE ERROR: Object undefined of type undefined and Object undefined of type undefined must both be Boolean
|
||||
LINE (28:11) ** TYPE ERROR: Undefined variable b
|
||||
LINE (28:7) ** TYPE ERROR: Undefined variable b
|
||||
LINE (28:2) ** TYPE ERROR: Undefined variable b
|
||||
029: b := 1 | b;
|
||||
LINE (29:12) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (29:12) ** TYPE ERROR: Object $t9 of type integer and Object undefined of type undefined must both be Boolean
|
||||
LINE (29:11) ** TYPE ERROR: Undefined variable b
|
||||
LINE (29:2) ** TYPE ERROR: Undefined variable b
|
||||
030: b := b | 1;
|
||||
LINE (30:12) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (30:12) ** TYPE ERROR: Object undefined of type undefined and Object $t10 of type integer must both be Boolean
|
||||
LINE (30:7) ** TYPE ERROR: Undefined variable b
|
||||
LINE (30:2) ** TYPE ERROR: Undefined variable b
|
||||
031: b := b & 1;
|
||||
LINE (31:12) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (31:12) ** TYPE ERROR: Object undefined of type undefined and Object $t11 of type integer must both be Boolean
|
||||
LINE (31:7) ** TYPE ERROR: Undefined variable b
|
||||
LINE (31:2) ** TYPE ERROR: Undefined variable b
|
||||
032: b := 1 & b;
|
||||
LINE (32:12) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (32:12) ** TYPE ERROR: Object $t12 of type integer and Object undefined of type undefined must both be Boolean
|
||||
LINE (32:11) ** TYPE ERROR: Undefined variable b
|
||||
LINE (32:2) ** TYPE ERROR: Undefined variable b
|
||||
033: b := 1 = 1;
|
||||
LINE (33:12) ** TYPE ERROR: Assignable Assign Expression - Object undefined of type undefined != Object $t15 of type Boolean
|
||||
LINE (33:12) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (33:2) ** TYPE ERROR: Undefined variable b
|
||||
034:
|
||||
035:
|
||||
036:
|
||||
037: b := 1 = b;
|
||||
LINE (37:12) ** TYPE ERROR: Invalid type passed to assignable.
|
||||
LINE (37:12) ** TYPE ERROR: Object $t16 of type integer and Object undefined of type undefined must both be the same type
|
||||
LINE (37:11) ** TYPE ERROR: Undefined variable b
|
||||
LINE (37:2) ** TYPE ERROR: Undefined variable b
|
||||
038:
|
||||
039: return 0;
|
||||
040: }
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user