diff --git a/Makefile b/Makefile index 794b839..68a4858 100644 --- a/Makefile +++ b/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 # ----------- \ No newline at end of file diff --git a/check.sh b/check.sh deleted file mode 100755 index cf7c946..0000000 --- a/check.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/symbol_table.c b/src/symbol_table.c index f4fa1ea..000fbc1 100644 --- a/src/symbol_table.c +++ b/src/symbol_table.c @@ -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; } diff --git a/test.sh b/test.sh index 3f6f5a9..ce2d31d 100755 --- a/test.sh +++ b/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 [flags] ${WHITE} Run the test on a single file" + echo -e "${GREEN} ./test.sh [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: [ ] *)" + echo -e "${ORANGE} where 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 : 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 diff --git a/tests/carl/NoErrors/type.array.alpha b/tests/carl/NoErrors/type.array.alpha deleted file mode 100644 index 2b04ba0..0000000 --- a/tests/carl/NoErrors/type.array.alpha +++ /dev/null @@ -1 +0,0 @@ -type A : 1 -> integer diff --git a/tests/carl/NoErrors/entry.definition.alpha.asc b/tests/given/expected/entry.definition.alpha.asc similarity index 100% rename from tests/carl/NoErrors/entry.definition.alpha.asc rename to tests/given/expected/entry.definition.alpha.asc diff --git a/tests/carl/NoErrors/entry.duplicateDifferent.alpha.asc b/tests/given/expected/entry.duplicateDifferent.alpha.asc similarity index 100% rename from tests/carl/NoErrors/entry.duplicateDifferent.alpha.asc rename to tests/given/expected/entry.duplicateDifferent.alpha.asc diff --git a/tests/carl/NoErrors/entry.duplicateSame.alpha.asc b/tests/given/expected/entry.duplicateSame.alpha.asc similarity index 100% rename from tests/carl/NoErrors/entry.duplicateSame.alpha.asc rename to tests/given/expected/entry.duplicateSame.alpha.asc diff --git a/tests/carl/NoErrors/entry.local.alpha.asc b/tests/given/expected/entry.local.alpha.asc similarity index 100% rename from tests/carl/NoErrors/entry.local.alpha.asc rename to tests/given/expected/entry.local.alpha.asc diff --git a/tests/carl/Errors/entry.undeclaredType.alpha.asc b/tests/given/expected/error.entry.undeclaredType.alpha.asc similarity index 100% rename from tests/carl/Errors/entry.undeclaredType.alpha.asc rename to tests/given/expected/error.entry.undeclaredType.alpha.asc diff --git a/tests/carl/Errors/entry.undeclaredVar.alpha.asc b/tests/given/expected/error.entry.undeclaredVar.alpha.asc similarity index 100% rename from tests/carl/Errors/entry.undeclaredVar.alpha.asc rename to tests/given/expected/error.entry.undeclaredVar.alpha.asc diff --git a/tests/carl/NoErrors/error.none.alpha.asc b/tests/given/expected/error.none.alpha.asc similarity index 100% rename from tests/carl/NoErrors/error.none.alpha.asc rename to tests/given/expected/error.none.alpha.asc diff --git a/tests/carl/Errors/error.operator.alpha.asc b/tests/given/expected/error.operator.alpha.asc similarity index 100% rename from tests/carl/Errors/error.operator.alpha.asc rename to tests/given/expected/error.operator.alpha.asc diff --git a/tests/carl/NoErrors/function.declaration.alpha.asc b/tests/given/expected/function.declaration.alpha.asc similarity index 100% rename from tests/carl/NoErrors/function.declaration.alpha.asc rename to tests/given/expected/function.declaration.alpha.asc diff --git a/tests/carl/NoErrors/function.definition.alpha.asc b/tests/given/expected/function.definition.alpha.asc similarity index 100% rename from tests/carl/NoErrors/function.definition.alpha.asc rename to tests/given/expected/function.definition.alpha.asc diff --git a/tests/carl/NoErrors/functionValue.alpha.asc b/tests/given/expected/functionValue.alpha.asc similarity index 100% rename from tests/carl/NoErrors/functionValue.alpha.asc rename to tests/given/expected/functionValue.alpha.asc diff --git a/tests/carl/NoErrors/sample.good.alpha.asc b/tests/given/expected/sample.good.alpha.asc similarity index 100% rename from tests/carl/NoErrors/sample.good.alpha.asc rename to tests/given/expected/sample.good.alpha.asc diff --git a/tests/carl/NoErrors/selectionSort.alpha.asc b/tests/given/expected/selectionSort.alpha.asc similarity index 100% rename from tests/carl/NoErrors/selectionSort.alpha.asc rename to tests/given/expected/selectionSort.alpha.asc diff --git a/tests/carl/NoErrors/type.array.alpha.asc b/tests/given/expected/type.array.alpha.asc similarity index 100% rename from tests/carl/NoErrors/type.array.alpha.asc rename to tests/given/expected/type.array.alpha.asc diff --git a/tests/carl/NoErrors/type.mapping.alpha.asc b/tests/given/expected/type.mapping.alpha.asc similarity index 100% rename from tests/carl/NoErrors/type.mapping.alpha.asc rename to tests/given/expected/type.mapping.alpha.asc diff --git a/tests/carl/NoErrors/type.record.alpha.asc b/tests/given/expected/type.record.alpha.asc similarity index 100% rename from tests/carl/NoErrors/type.record.alpha.asc rename to tests/given/expected/type.record.alpha.asc diff --git a/tests/carl/NoErrors/types.alpha.asc b/tests/given/expected/types.alpha.asc similarity index 100% rename from tests/carl/NoErrors/types.alpha.asc rename to tests/given/expected/types.alpha.asc diff --git a/tests/carl/NoErrors/entry.definition.alpha b/tests/given/test/entry.definition.alpha similarity index 83% rename from tests/carl/NoErrors/entry.definition.alpha rename to tests/given/test/entry.definition.alpha index 0003cd5..75f6a38 100644 --- a/tests/carl/NoErrors/entry.definition.alpha +++ b/tests/given/test/entry.definition.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) (* type string : 1 -> character *) type M : string -> integer diff --git a/tests/carl/NoErrors/entry.duplicateDifferent.alpha b/tests/given/test/entry.duplicateDifferent.alpha similarity index 85% rename from tests/carl/NoErrors/entry.duplicateDifferent.alpha rename to tests/given/test/entry.duplicateDifferent.alpha index 5cbd668..6a75b69 100644 --- a/tests/carl/NoErrors/entry.duplicateDifferent.alpha +++ b/tests/given/test/entry.duplicateDifferent.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type M : string -> integer function entry : M diff --git a/tests/carl/NoErrors/entry.duplicateSame.alpha b/tests/given/test/entry.duplicateSame.alpha similarity index 83% rename from tests/carl/NoErrors/entry.duplicateSame.alpha rename to tests/given/test/entry.duplicateSame.alpha index 554b9d8..435e170 100644 --- a/tests/carl/NoErrors/entry.duplicateSame.alpha +++ b/tests/given/test/entry.duplicateSame.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type M : string -> integer function entry : M diff --git a/tests/carl/NoErrors/entry.local.alpha b/tests/given/test/entry.local.alpha similarity index 84% rename from tests/carl/NoErrors/entry.local.alpha rename to tests/given/test/entry.local.alpha index cff2062..f2efa3a 100644 --- a/tests/carl/NoErrors/entry.local.alpha +++ b/tests/given/test/entry.local.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type M : string -> integer function entry : M diff --git a/tests/carl/Errors/entry.undeclaredType.alpha b/tests/given/test/error.entry.undeclaredType.alpha similarity index 81% rename from tests/carl/Errors/entry.undeclaredType.alpha rename to tests/given/test/error.entry.undeclaredType.alpha index 6b9531f..9de0d02 100644 --- a/tests/carl/Errors/entry.undeclaredType.alpha +++ b/tests/given/test/error.entry.undeclaredType.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type M : string -> integer function foo : M diff --git a/tests/carl/Errors/entry.undeclaredVar.alpha b/tests/given/test/error.entry.undeclaredVar.alpha similarity index 77% rename from tests/carl/Errors/entry.undeclaredVar.alpha rename to tests/given/test/error.entry.undeclaredVar.alpha index 6cd5fa7..29a502c 100644 --- a/tests/carl/Errors/entry.undeclaredVar.alpha +++ b/tests/given/test/error.entry.undeclaredVar.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type M : string -> integer function entry : M diff --git a/tests/carl/NoErrors/error.none.alpha b/tests/given/test/error.none.alpha similarity index 90% rename from tests/carl/NoErrors/error.none.alpha rename to tests/given/test/error.none.alpha index 85aa4f2..bd54c16 100644 --- a/tests/carl/NoErrors/error.none.alpha +++ b/tests/given/test/error.none.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type string2int: string -> integer function entry : string2int diff --git a/tests/carl/Errors/error.operator.alpha b/tests/given/test/error.operator.alpha similarity index 90% rename from tests/carl/Errors/error.operator.alpha rename to tests/given/test/error.operator.alpha index a7b0691..bb2e79c 100644 --- a/tests/carl/Errors/error.operator.alpha +++ b/tests/given/test/error.operator.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type string2int: string -> integer function entry : string2int diff --git a/tests/carl/NoErrors/function.declaration.alpha b/tests/given/test/function.declaration.alpha similarity index 65% rename from tests/carl/NoErrors/function.declaration.alpha rename to tests/given/test/function.declaration.alpha index 69f210f..2396d45 100644 --- a/tests/carl/NoErrors/function.declaration.alpha +++ b/tests/given/test/function.declaration.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type M : integer -> integer function f : M diff --git a/tests/carl/NoErrors/function.definition.alpha b/tests/given/test/function.definition.alpha similarity index 75% rename from tests/carl/NoErrors/function.definition.alpha rename to tests/given/test/function.definition.alpha index b729610..ffafb72 100644 --- a/tests/carl/NoErrors/function.definition.alpha +++ b/tests/given/test/function.definition.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type M : integer -> integer function f : M diff --git a/tests/carl/NoErrors/functionValue.alpha b/tests/given/test/functionValue.alpha similarity index 92% rename from tests/carl/NoErrors/functionValue.alpha rename to tests/given/test/functionValue.alpha index cac92bb..b128b13 100644 --- a/tests/carl/NoErrors/functionValue.alpha +++ b/tests/given/test/functionValue.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) (* Type definitions *) (* mapping type *) @@ -57,11 +58,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,'a')) + if (d(1,2,'c')) then { result := 0; } diff --git a/tests/carl/NoErrors/sample.good.alpha b/tests/given/test/sample.good.alpha similarity index 96% rename from tests/carl/NoErrors/sample.good.alpha rename to tests/given/test/sample.good.alpha index 8a8b727..8153085 100644 --- a/tests/carl/NoErrors/sample.good.alpha +++ b/tests/given/test/sample.good.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) (* Type definitions *) type int2int: integer -> integer diff --git a/tests/carl/NoErrors/selectionSort.alpha b/tests/given/test/selectionSort.alpha similarity index 97% rename from tests/carl/NoErrors/selectionSort.alpha rename to tests/given/test/selectionSort.alpha index 24fb000..489f355 100644 --- a/tests/carl/NoErrors/selectionSort.alpha +++ b/tests/given/test/selectionSort.alpha @@ -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 diff --git a/tests/given/test/type.array.alpha b/tests/given/test/type.array.alpha new file mode 100644 index 0000000..3aec34c --- /dev/null +++ b/tests/given/test/type.array.alpha @@ -0,0 +1,2 @@ +(* TEST: [-asc -tc] *) +type A : 1 -> integer diff --git a/tests/carl/NoErrors/type.mapping.alpha b/tests/given/test/type.mapping.alpha similarity index 57% rename from tests/carl/NoErrors/type.mapping.alpha rename to tests/given/test/type.mapping.alpha index 8b6bc50..dc4f63d 100644 --- a/tests/carl/NoErrors/type.mapping.alpha +++ b/tests/given/test/type.mapping.alpha @@ -1,2 +1,3 @@ +(* TEST: [-asc -tc] *) type M : integer -> character diff --git a/tests/carl/NoErrors/type.record.alpha b/tests/given/test/type.record.alpha similarity index 64% rename from tests/carl/NoErrors/type.record.alpha rename to tests/given/test/type.record.alpha index 2c5e9c9..9c2b1c6 100644 --- a/tests/carl/NoErrors/type.record.alpha +++ b/tests/given/test/type.record.alpha @@ -1 +1,2 @@ +(* TEST: [-asc -tc] *) type R : [ integer : i ; character : c ] diff --git a/tests/carl/NoErrors/types.alpha b/tests/given/test/types.alpha similarity index 98% rename from tests/carl/NoErrors/types.alpha rename to tests/given/test/types.alpha index 0402f95..47e92f5 100644 --- a/tests/carl/NoErrors/types.alpha +++ b/tests/given/test/types.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) (* At compiler start-up your program should diff --git a/tests/sprint1/expected/sp1_comment_fix1.expected b/tests/sprint1/expected/sp1_comment_fix1.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_comment_fix1.expected rename to tests/sprint1/expected/sp1_comment_fix1.tok.exp diff --git a/tests/sprint1/expected/sp1_comment_fix2.expected b/tests/sprint1/expected/sp1_comment_fix2.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_comment_fix2.expected rename to tests/sprint1/expected/sp1_comment_fix2.tok.exp diff --git a/tests/sprint1/expected/sp1_comment_issues.expected b/tests/sprint1/expected/sp1_comment_issues.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_comment_issues.expected rename to tests/sprint1/expected/sp1_comment_issues.tok.exp diff --git a/tests/sprint1/expected/sp1_comments.expected b/tests/sprint1/expected/sp1_comments.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_comments.expected rename to tests/sprint1/expected/sp1_comments.tok.exp diff --git a/tests/sprint1/expected/sp1_general_token.expected b/tests/sprint1/expected/sp1_general_token.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_general_token.expected rename to tests/sprint1/expected/sp1_general_token.tok.exp diff --git a/tests/sprint1/expected/sp1_keywords.expected b/tests/sprint1/expected/sp1_keywords.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_keywords.expected rename to tests/sprint1/expected/sp1_keywords.tok.exp diff --git a/tests/sprint1/expected/sp1_operators.expected b/tests/sprint1/expected/sp1_operators.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_operators.expected rename to tests/sprint1/expected/sp1_operators.tok.exp diff --git a/tests/sprint1/expected/sp1_other_punc.expected b/tests/sprint1/expected/sp1_other_punc.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_other_punc.expected rename to tests/sprint1/expected/sp1_other_punc.tok.exp diff --git a/tests/sprint1/expected/sp1_punc_grouping.expected b/tests/sprint1/expected/sp1_punc_grouping.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_punc_grouping.expected rename to tests/sprint1/expected/sp1_punc_grouping.tok.exp diff --git a/tests/sprint1/expected/sp1_real_alpha_file1.expected b/tests/sprint1/expected/sp1_real_alpha_file1.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_real_alpha_file1.expected rename to tests/sprint1/expected/sp1_real_alpha_file1.tok.exp diff --git a/tests/sprint1/expected/sp1_real_alpha_file2.expected b/tests/sprint1/expected/sp1_real_alpha_file2.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_real_alpha_file2.expected rename to tests/sprint1/expected/sp1_real_alpha_file2.tok.exp diff --git a/tests/sprint1/expected/sp1_simple_alpha.tok.exp b/tests/sprint1/expected/sp1_simple_alpha.tok.exp new file mode 100644 index 0000000..8672f7a --- /dev/null +++ b/tests/sprint1/expected/sp1_simple_alpha.tok.exp @@ -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 "}" diff --git a/tests/sprint1/expected/sp1_simple_int.expected b/tests/sprint1/expected/sp1_simple_int.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_simple_int.expected rename to tests/sprint1/expected/sp1_simple_int.tok.exp diff --git a/tests/sprint1/expected/sp1_simple_literals.expected b/tests/sprint1/expected/sp1_simple_literals.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_simple_literals.expected rename to tests/sprint1/expected/sp1_simple_literals.tok.exp diff --git a/tests/sprint1/expected/sp1_variables.expected b/tests/sprint1/expected/sp1_variables.tok.exp similarity index 100% rename from tests/sprint1/expected/sp1_variables.expected rename to tests/sprint1/expected/sp1_variables.tok.exp diff --git a/tests/sprint1/test/sp1_comment_fix1.alpha b/tests/sprint1/test/sp1_comment_fix1.alpha index 910a538..25e4ba9 100644 --- a/tests/sprint1/test/sp1_comment_fix1.alpha +++ b/tests/sprint1/test/sp1_comment_fix1.alpha @@ -1 +1,2 @@ +(* TEST: [-tok] *) (***) \ No newline at end of file diff --git a/tests/sprint1/test/sp1_comment_fix2.alpha b/tests/sprint1/test/sp1_comment_fix2.alpha index bd710e9..0ba95b5 100644 --- a/tests/sprint1/test/sp1_comment_fix2.alpha +++ b/tests/sprint1/test/sp1_comment_fix2.alpha @@ -1 +1,2 @@ +(* TEST: [-tok] *) (*(**)*) \ No newline at end of file diff --git a/tests/sprint1/test/sp1_comment_issues.alpha b/tests/sprint1/test/sp1_comment_issues.alpha index e968d93..05d3636 100644 --- a/tests/sprint1/test/sp1_comment_issues.alpha +++ b/tests/sprint1/test/sp1_comment_issues.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) (*(**)*) (***) (******)(*\kpp*********) diff --git a/tests/sprint1/test/sp1_comments.alpha b/tests/sprint1/test/sp1_comments.alpha index 1111428..f30501b 100644 --- a/tests/sprint1/test/sp1_comments.alpha +++ b/tests/sprint1/test/sp1_comments.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) (* hello *) (* hello *) (* I'd think this is a legal "string" that contains several \n \t diff --git a/tests/sprint1/test/sp1_general_token.alpha b/tests/sprint1/test/sp1_general_token.alpha index defc56b..9e1389d 100644 --- a/tests/sprint1/test/sp1_general_token.alpha +++ b/tests/sprint1/test/sp1_general_token.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) This is a test 9combined 7okens 12345 diff --git a/tests/sprint1/test/sp1_keywords.alpha b/tests/sprint1/test/sp1_keywords.alpha index ff18168..e60a891 100644 --- a/tests/sprint1/test/sp1_keywords.alpha +++ b/tests/sprint1/test/sp1_keywords.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) while While whiLe diff --git a/tests/sprint1/test/sp1_operators.alpha b/tests/sprint1/test/sp1_operators.alpha index b985387..515ce69 100644 --- a/tests/sprint1/test/sp1_operators.alpha +++ b/tests/sprint1/test/sp1_operators.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) + - * diff --git a/tests/sprint1/test/sp1_other_punc.alpha b/tests/sprint1/test/sp1_other_punc.alpha index bd1f2de..a9981db 100644 --- a/tests/sprint1/test/sp1_other_punc.alpha +++ b/tests/sprint1/test/sp1_other_punc.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) ; : , diff --git a/tests/sprint1/test/sp1_punc_grouping.alpha b/tests/sprint1/test/sp1_punc_grouping.alpha index 45dfb99..c512933 100644 --- a/tests/sprint1/test/sp1_punc_grouping.alpha +++ b/tests/sprint1/test/sp1_punc_grouping.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) ) a) )a diff --git a/tests/sprint1/test/sp1_real_alpha_file1.alpha b/tests/sprint1/test/sp1_real_alpha_file1.alpha index 51d5d08..f729f0b 100644 --- a/tests/sprint1/test/sp1_real_alpha_file1.alpha +++ b/tests/sprint1/test/sp1_real_alpha_file1.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) type rec: [integer: x; integer: y] type T1: integer -> integer type T2: rec -> integer diff --git a/tests/sprint1/test/sp1_real_alpha_file2.alpha b/tests/sprint1/test/sp1_real_alpha_file2.alpha index 0beb2af..409d6d3 100644 --- a/tests/sprint1/test/sp1_real_alpha_file2.alpha +++ b/tests/sprint1/test/sp1_real_alpha_file2.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) (* Type definitions *) type string: 1 -> character type int2int: integer -> integer diff --git a/tests/sprint1/test/sp1_simple_alpha.alpha b/tests/sprint1/test/sp1_simple_alpha.alpha index 719384b..3f59493 100644 --- a/tests/sprint1/test/sp1_simple_alpha.alpha +++ b/tests/sprint1/test/sp1_simple_alpha.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) type main: string -> integer function entry: main diff --git a/tests/sprint1/test/sp1_simple_int.alpha b/tests/sprint1/test/sp1_simple_int.alpha index 127f0a6..32c572d 100644 --- a/tests/sprint1/test/sp1_simple_int.alpha +++ b/tests/sprint1/test/sp1_simple_int.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) 45 123 8392 diff --git a/tests/sprint1/test/sp1_simple_literals.alpha b/tests/sprint1/test/sp1_simple_literals.alpha index 4c5b0b2..ba4aa9d 100644 --- a/tests/sprint1/test/sp1_simple_literals.alpha +++ b/tests/sprint1/test/sp1_simple_literals.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) "this is a string" 721398 'g' '/n' (* should print 3 tokens before this *) ' ' diff --git a/tests/sprint1/test/sp1_variables.alpha b/tests/sprint1/test/sp1_variables.alpha index 26db6c0..7e69840 100644 --- a/tests/sprint1/test/sp1_variables.alpha +++ b/tests/sprint1/test/sp1_variables.alpha @@ -1,3 +1,4 @@ +(* TEST: [-tok] *) valid1 Valid2 _valid3 diff --git a/tests/sprint2/expected/sp2_carls_mistake.expected b/tests/sprint2/expected/sp2_carls_mistake.st.exp similarity index 80% rename from tests/sprint2/expected/sp2_carls_mistake.expected rename to tests/sprint2/expected/sp2_carls_mistake.st.exp index cee5d6f..7fe89f6 100644 --- a/tests/sprint2/expected/sp2_carls_mistake.expected +++ b/tests/sprint2/expected/sp2_carls_mistake.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_function_types.expected b/tests/sprint2/expected/sp2_function_types.st.exp similarity index 67% rename from tests/sprint2/expected/sp2_function_types.expected rename to tests/sprint2/expected/sp2_function_types.st.exp index 391690b..707ff66 100644 --- a/tests/sprint2/expected/sp2_function_types.expected +++ b/tests/sprint2/expected/sp2_function_types.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_integer_binary_op.expected b/tests/sprint2/expected/sp2_integer_binary_op.st.exp similarity index 83% rename from tests/sprint2/expected/sp2_integer_binary_op.expected rename to tests/sprint2/expected/sp2_integer_binary_op.st.exp index d24c170..b418814 100644 --- a/tests/sprint2/expected/sp2_integer_binary_op.expected +++ b/tests/sprint2/expected/sp2_integer_binary_op.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_invalid_multiple_params_no_as.expected b/tests/sprint2/expected/sp2_invalid_multiple_params_no_as.st.exp similarity index 82% rename from tests/sprint2/expected/sp2_invalid_multiple_params_no_as.expected rename to tests/sprint2/expected/sp2_invalid_multiple_params_no_as.st.exp index 509c6eb..df23356 100644 --- a/tests/sprint2/expected/sp2_invalid_multiple_params_no_as.expected +++ b/tests/sprint2/expected/sp2_invalid_multiple_params_no_as.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_invalid_recop.expected b/tests/sprint2/expected/sp2_invalid_recop.st.exp similarity index 82% rename from tests/sprint2/expected/sp2_invalid_recop.expected rename to tests/sprint2/expected/sp2_invalid_recop.st.exp index 642ad85..b6a78e2 100644 --- a/tests/sprint2/expected/sp2_invalid_recop.expected +++ b/tests/sprint2/expected/sp2_invalid_recop.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_invalid_release.expected b/tests/sprint2/expected/sp2_invalid_release.st.exp similarity index 85% rename from tests/sprint2/expected/sp2_invalid_release.expected rename to tests/sprint2/expected/sp2_invalid_release.st.exp index 1ac0274..823a68c 100644 --- a/tests/sprint2/expected/sp2_invalid_release.expected +++ b/tests/sprint2/expected/sp2_invalid_release.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_library.expected b/tests/sprint2/expected/sp2_library.st.exp similarity index 79% rename from tests/sprint2/expected/sp2_library.expected rename to tests/sprint2/expected/sp2_library.st.exp index 80a9611..a625233 100644 --- a/tests/sprint2/expected/sp2_library.expected +++ b/tests/sprint2/expected/sp2_library.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_llnode.st.exp b/tests/sprint2/expected/sp2_llnode.st.exp new file mode 100644 index 0000000..8b78bd3 --- /dev/null +++ b/tests/sprint2/expected/sp2_llnode.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_llnode.expected b/tests/sprint2/expected/sp2_llnode_bad.st.exp similarity index 72% rename from tests/sprint2/expected/sp2_llnode.expected rename to tests/sprint2/expected/sp2_llnode_bad.st.exp index ab13e6f..cebad8b 100644 --- a/tests/sprint2/expected/sp2_llnode.expected +++ b/tests/sprint2/expected/sp2_llnode_bad.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_one_line.expected b/tests/sprint2/expected/sp2_one_line.st.exp similarity index 77% rename from tests/sprint2/expected/sp2_one_line.expected rename to tests/sprint2/expected/sp2_one_line.st.exp index dcdd20a..f8d9751 100644 --- a/tests/sprint2/expected/sp2_one_line.expected +++ b/tests/sprint2/expected/sp2_one_line.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_presidence.expected b/tests/sprint2/expected/sp2_presidence.st.exp similarity index 84% rename from tests/sprint2/expected/sp2_presidence.expected rename to tests/sprint2/expected/sp2_presidence.st.exp index 80d2312..2c97464 100644 --- a/tests/sprint2/expected/sp2_presidence.expected +++ b/tests/sprint2/expected/sp2_presidence.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_simple.expected b/tests/sprint2/expected/sp2_simple.st.exp similarity index 77% rename from tests/sprint2/expected/sp2_simple.expected rename to tests/sprint2/expected/sp2_simple.st.exp index 649bea7..71d24c9 100644 --- a/tests/sprint2/expected/sp2_simple.expected +++ b/tests/sprint2/expected/sp2_simple.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_sp2_arrayargs.expected b/tests/sprint2/expected/sp2_sp2_arrayargs.st.exp similarity index 79% rename from tests/sprint2/expected/sp2_sp2_arrayargs.expected rename to tests/sprint2/expected/sp2_sp2_arrayargs.st.exp index 0db9d5a..b76e609 100644 --- a/tests/sprint2/expected/sp2_sp2_arrayargs.expected +++ b/tests/sprint2/expected/sp2_sp2_arrayargs.st.exp @@ -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 diff --git a/tests/sprint2/expected/sp2_valid_assignable_and_mem.expected b/tests/sprint2/expected/sp2_valid_assignable_and_mem.expected deleted file mode 100644 index aa4b733..0000000 --- a/tests/sprint2/expected/sp2_valid_assignable_and_mem.expected +++ /dev/null @@ -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 diff --git a/tests/sprint3/expected/sp3_primitive_type_check.expected b/tests/sprint2/expected/sp2_valid_assignable_and_mem.st.exp similarity index 50% rename from tests/sprint3/expected/sp3_primitive_type_check.expected rename to tests/sprint2/expected/sp2_valid_assignable_and_mem.st.exp index 0a57752..e755b52 100644 --- a/tests/sprint3/expected/sp3_primitive_type_check.expected +++ b/tests/sprint2/expected/sp2_valid_assignable_and_mem.st.exp @@ -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 diff --git a/tests/sprint2/test/sp2_carls_mistake.alpha b/tests/sprint2/test/sp2_carls_mistake.alpha index b7fa8ee..72fa548 100644 --- a/tests/sprint2/test/sp2_carls_mistake.alpha +++ b/tests/sprint2/test/sp2_carls_mistake.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type rec: [integer: x; integer: y] type T1: integer -> integer diff --git a/tests/sprint2/test/sp2_function_types.alpha b/tests/sprint2/test/sp2_function_types.alpha index 62711c3..00dba5a 100644 --- a/tests/sprint2/test/sp2_function_types.alpha +++ b/tests/sprint2/test/sp2_function_types.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type Boolean2Boolean: Boolean -> Boolean type integer2integer: integer -> integer type character2integer: character -> integer diff --git a/tests/sprint2/test/sp2_integer_binary_op.alpha b/tests/sprint2/test/sp2_integer_binary_op.alpha index 2dfeb73..cd14c82 100644 --- a/tests/sprint2/test/sp2_integer_binary_op.alpha +++ b/tests/sprint2/test/sp2_integer_binary_op.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type main: string -> integer function entry: main type testarr : 1 -> integer diff --git a/tests/sprint2/test/sp2_invalid_multiple_params_no_as.alpha b/tests/sprint2/test/sp2_invalid_multiple_params_no_as.alpha index 805fb6e..882688e 100644 --- a/tests/sprint2/test/sp2_invalid_multiple_params_no_as.alpha +++ b/tests/sprint2/test/sp2_invalid_multiple_params_no_as.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type rec: [integer: x; integer: y] type main: rec -> integer function test: main diff --git a/tests/sprint2/test/sp2_invalid_recop.alpha b/tests/sprint2/test/sp2_invalid_recop.alpha index 41b3a55..79202f5 100644 --- a/tests/sprint2/test/sp2_invalid_recop.alpha +++ b/tests/sprint2/test/sp2_invalid_recop.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type main: string -> integer function entry: main diff --git a/tests/sprint2/test/sp2_invalid_release.alpha b/tests/sprint2/test/sp2_invalid_release.alpha index 2bd645a..e29ac0b 100644 --- a/tests/sprint2/test/sp2_invalid_release.alpha +++ b/tests/sprint2/test/sp2_invalid_release.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type rec: [integer: x; integer: y] entry (arg) := { diff --git a/tests/sprint2/test/sp2_library.alpha b/tests/sprint2/test/sp2_library.alpha index 82120be..d0c9d6c 100644 --- a/tests/sprint2/test/sp2_library.alpha +++ b/tests/sprint2/test/sp2_library.alpha @@ -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) diff --git a/tests/sprint2/test/sp2_llnode.alpha b/tests/sprint2/test/sp2_llnode.alpha index c78687d..7367fb5 100644 --- a/tests/sprint2/test/sp2_llnode.alpha +++ b/tests/sprint2/test/sp2_llnode.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type main: string -> integer function entry: main diff --git a/tests/sprint2/test/sp2_llnode_bad.alpha b/tests/sprint2/test/sp2_llnode_bad.alpha index 4eab1ae..0862fa0 100644 --- a/tests/sprint2/test/sp2_llnode_bad.alpha +++ b/tests/sprint2/test/sp2_llnode_bad.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type main: string -> integer function entry: main diff --git a/tests/sprint2/test/sp2_one_line.alpha b/tests/sprint2/test/sp2_one_line.alpha index f1062e9..5502979 100644 --- a/tests/sprint2/test/sp2_one_line.alpha +++ b/tests/sprint2/test/sp2_one_line.alpha @@ -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; } diff --git a/tests/sprint2/test/sp2_presidence.alpha b/tests/sprint2/test/sp2_presidence.alpha index d60611d..a81a5eb 100644 --- a/tests/sprint2/test/sp2_presidence.alpha +++ b/tests/sprint2/test/sp2_presidence.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type main: string -> integer type rec: [integer: rec_x; integer: rec_y] diff --git a/tests/sprint2/test/sp2_simple.alpha b/tests/sprint2/test/sp2_simple.alpha index 4042a5a..bc56caf 100644 --- a/tests/sprint2/test/sp2_simple.alpha +++ b/tests/sprint2/test/sp2_simple.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type main: string -> integer function entry: main diff --git a/tests/sprint2/test/sp2_sp2_arrayargs.alpha b/tests/sprint2/test/sp2_sp2_arrayargs.alpha index dfb0332..9ea2a1c 100644 --- a/tests/sprint2/test/sp2_sp2_arrayargs.alpha +++ b/tests/sprint2/test/sp2_sp2_arrayargs.alpha @@ -1,3 +1,4 @@ +(* TEST: [-st] *) type string: 1 -> character type a_of_s: 1 -> string diff --git a/tests/sprint2/test/sp2_sp2_arrayargs.alpha~ b/tests/sprint2/test/sp2_sp2_arrayargs.alpha~ deleted file mode 100644 index ce1673d..0000000 --- a/tests/sprint2/test/sp2_sp2_arrayargs.alpha~ +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/tests/sprint2/test/sp2_valid_assignable_and_mem.alpha b/tests/sprint2/test/sp2_valid_assignable_and_mem.alpha index a49c5dd..9fe5655 100644 --- a/tests/sprint2/test/sp2_valid_assignable_and_mem.alpha +++ b/tests/sprint2/test/sp2_valid_assignable_and_mem.alpha @@ -1,4 +1,5 @@ -type main: string -> integer +(* TEST: [-st] *) +ype main: string -> integer function entry: main type rec: [integer: x; integer: y] diff --git a/tests/sprint3/expected/sp3_and_or_type_check.asc.exp b/tests/sprint3/expected/sp3_and_or_type_check.asc.exp new file mode 100644 index 0000000..fb7fe0c --- /dev/null +++ b/tests/sprint3/expected/sp3_and_or_type_check.asc.exp @@ -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: } diff --git a/tests/sprint3/expected/sp3_and_or_type_check.expected b/tests/sprint3/expected/sp3_and_or_type_check.expected deleted file mode 100644 index 493f53b..0000000 --- a/tests/sprint3/expected/sp3_and_or_type_check.expected +++ /dev/null @@ -1,50 +0,0 @@ -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; -009: } -010: -011: while (7) { -012: x := 1; -013: } -014: -015: if (true) then { -016: x := 1; -017: } else { -018: x := 0; -019: } -020: -021: if (x) then { -022: x := 0; -023: } else { -024: x := 1; -025: } -026: -027: b := b | b; -028: b := b & b; -029: b := 1 | b; - LINE (29:12) ** TYPE ERROR: b != undefined - -030: b := b | 1; - LINE (30:12) ** TYPE ERROR: b != undefined - -031: b := b & 1; - LINE (31:12) ** TYPE ERROR: b != undefined - -032: b := 1 & b; - LINE (32:12) ** TYPE ERROR: b != undefined - -033: b := 1 = 1; -034: -035: -036: -037: b := 1 = b; - LINE (37:12) ** TYPE ERROR: b != undefined - -038: -039: return 0; -040: } diff --git a/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.asc.exp b/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.asc.exp new file mode 100644 index 0000000..b9eabd2 --- /dev/null +++ b/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.asc.exp @@ -0,0 +1,17 @@ +001: type main: string -> integer +002: function entry: main +003: +004: entry (arg) := { +005: [integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1] +006: +007: b2 := 3 < x; +008: b1 := arr = 2; + LINE (8:18) ** TYPE ERROR: Assignable Assign Expression - Object b1 of type Boolean != Object undefined of type undefined + LINE (8:18) ** TYPE ERROR: Object arr of type address and Object $t2 of type integer must both be the same type +009: b1 := 6<7 & arr2=7; + LINE (9:23) ** TYPE ERROR: Assignable Assign Expression - Object b1 of type Boolean != Object undefined of type undefined + LINE (9:23) ** TYPE ERROR: Object $t5 of type Boolean and Object undefined of type undefined must both be Boolean + LINE (9:23) ** TYPE ERROR: Object arr2 of type address and Object $t6 of type integer must both be the same type +010: +011: return 0; +012: } diff --git a/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.expected b/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.expected deleted file mode 100644 index f95e765..0000000 --- a/tests/sprint3/expected/sp3_boolean_binary_op_typecheck.expected +++ /dev/null @@ -1,16 +0,0 @@ -001: type main: string -> integer -002: function entry: main -003: -004: entry (arg) := { -005: [integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1] -006: -007: b2 := 3 < x; -008: b1 := arr = 2; - LINE (8:18) ** TYPE ERROR: b1 != undefined - -009: b1 := 6<7 & arr2=7; - LINE (9:23) ** TYPE ERROR: b1 != undefined - -010: -011: return 0; -012: } diff --git a/tests/sprint3/expected/sp3_boolean_unary_op_typecheck.expected b/tests/sprint3/expected/sp3_boolean_unary_op_typecheck.asc.exp similarity index 52% rename from tests/sprint3/expected/sp3_boolean_unary_op_typecheck.expected rename to tests/sprint3/expected/sp3_boolean_unary_op_typecheck.asc.exp index 39237bc..181f3c4 100644 --- a/tests/sprint3/expected/sp3_boolean_unary_op_typecheck.expected +++ b/tests/sprint3/expected/sp3_boolean_unary_op_typecheck.asc.exp @@ -6,8 +6,8 @@ 006: 007: b2 := !(3 < 2); 008: b1 := !5; - LINE (8:13) ** TYPE ERROR: b1 != undefined - + LINE (8:13) ** TYPE ERROR: Assignable Assign Expression - Object b1 of type Boolean != Object undefined of type undefined + LINE (8:12) ** TYPE ERROR: Object $t4 of type integer is not of type Boolean and can't be negated 009: 010: return 0; 011: } diff --git a/tests/sprint3/expected/sp3_carls_second_mistake.asc.exp b/tests/sprint3/expected/sp3_carls_second_mistake.asc.exp new file mode 100644 index 0000000..51a366e --- /dev/null +++ b/tests/sprint3/expected/sp3_carls_second_mistake.asc.exp @@ -0,0 +1,36 @@ +001: type main: string -> integer +002: function entry: main +003: +004: type string: 1 -> character +005: type a_of_s: 1 -> string +006: +007: (* maybe some other type definitions *) +008: +009: entry (arg) := { +010: [ string: one_name; string: another_name; a_of_s: many_names ] +011: +012: one_name := "a string literal"; +013: another_name := reserve another_name(4); (* reserve space for an an array of character, with 4 members *) + LINE (13:44) ** TYPE ERROR: Assignable Assign Expression - Object another_name of type string != Object undefined of type undefined +014: another_name(0) := 'C'; +015: another_name(1) := 'a'; +016: another_name(2) := 'r'; +017: another_name(3) := 'l'; +018: many_names := reserve many_names(3); + LINE (18:40) ** TYPE ERROR: Assignable Assign Expression - Object many_names of type a_of_s != Object undefined of type undefined +019: many_names(0) := one_name; +020: many_names(1) := another_name; +021: many_names(2) := reserve many_names(2)(6); (* reserve space for an item of the same type as a_of_s(2), an array of character, with 6 members *) + LINE (21:45) ** SYNTAX ERROR: Incorrect syntax at token ')' + LINE (21:44) ** SYNTAX ERROR: Incorrect syntax at token '6' + LINE (21:43) ** SYNTAX ERROR: Incorrect syntax at token '(' + LINE (21:43) ** TYPE ERROR: Assignable Assign Expression - Object $t20 of type string != Object undefined of type undefined +022: many_names(2)(0) := 'P'; +023: many_names(2)(1) := 'a'; +024: many_names(2)(2) := 'r'; +025: many_names(2)(3) := 't'; +026: many_names(2)(4) := 'h'; +027: many_names(2)(5) := 'o'; +028: +029: return 0; +030: } \ No newline at end of file diff --git a/tests/sprint3/expected/sp3_carls_second_mistake.expected b/tests/sprint3/expected/sp3_carls_second_mistake.expected deleted file mode 100644 index 6f509e0..0000000 --- a/tests/sprint3/expected/sp3_carls_second_mistake.expected +++ /dev/null @@ -1,20 +0,0 @@ -NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION : -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -a_of_s : 001001 : : 1 -> string : Type of Array -string : 001001 : : 1 -> character : 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 -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 -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -many_names : 009000 : 001001 : a_of_s : Array Instance -another_name : 009000 : 001001 : string : Array Instance -one_name : 009000 : 001001 : string : Array Instance -arg : 009000 : 001001 : string : Array Instance diff --git a/tests/sprint3/expected/sp3_if_else.asc.exp b/tests/sprint3/expected/sp3_if_else.asc.exp new file mode 100644 index 0000000..9bdc9e7 --- /dev/null +++ b/tests/sprint3/expected/sp3_if_else.asc.exp @@ -0,0 +1,25 @@ +001: type rec: [character: x; integer: y] +002: +003: type T2: rec -> integer +004: +005: type main: string -> integer +006: function entry: main +007: function bar: T2 +008: +009: bar (r,s) := { +010: return 0; +011: } +012: +013: entry (arg) := { +014: [ integer: result ; rec: w] +015: if ( result = result ) then { +016: if ( result < w.y ) then { +017: result := 8; +018: } else { +019: result := 9; +020: }(* *) +021: } else { +022: result := bar('c', 7); +023: } +024: return 0; +025: } diff --git a/tests/sprint3/expected/sp3_if_while.asc.exp b/tests/sprint3/expected/sp3_if_while.asc.exp new file mode 100644 index 0000000..f071f8c --- /dev/null +++ b/tests/sprint3/expected/sp3_if_while.asc.exp @@ -0,0 +1,27 @@ +001: type rec: [character: x; integer: y] +002: +003: type T2: rec -> integer +004: +005: type main: string -> integer +006: function entry: main +007: function bar: T2 +008: +009: bar (r,s) := { +010: return 0; +011: } +012: +013: entry (arg) := { +014: [ integer: result ; rec: w] +015: while ( result = result ) { +016: result := result + 8; +017: if ( result < w.y ) then { +018: while (true) { +019: result := 8; +020: } +021: } else { +022: result := 9; +023: } +024: result := bar('c', 7); +025: } +026: return 0; +027: } diff --git a/tests/sprint3/expected/sp3_integer_binary_op_typecheck.asc.exp b/tests/sprint3/expected/sp3_integer_binary_op_typecheck.asc.exp new file mode 100644 index 0000000..bff4a30 --- /dev/null +++ b/tests/sprint3/expected/sp3_integer_binary_op_typecheck.asc.exp @@ -0,0 +1,28 @@ +001: type main: string -> integer +002: +003: type rec: [integer: x; integer: y] +004: function entry: main +005: +006: entry (arg) := { +007: [integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1; character : a; rec : r] +008: +009: x := 3 + 2 * 8; +010: x := 3 - 2 / 8; +011: x := a * 2 % 8; + LINE (11:20) ** TYPE ERROR: Assignable Assign Expression - Object x of type integer != Object undefined of type undefined + LINE (11:19) ** TYPE ERROR: Object undefined of type undefined and Object $t11 of type integer must both be integers + LINE (11:15) ** TYPE ERROR: Object a of type character and Object $t10 of type integer must both be integers +012: b2 := 3 * 2 % 8; +013: x := 3 % 2 * 8; +014: x := 3 + arr - 8; + LINE (14:22) ** TYPE ERROR: Assignable Assign Expression - Object x of type integer != Object undefined of type undefined + LINE (14:22) ** TYPE ERROR: Object undefined of type undefined and Object $t23 of type integer must both be integers + LINE (14:19) ** TYPE ERROR: Object $t22 of type integer and Object arr of type address must both be integers + LINE (14:19) ** TYPE ERROR: $t22 != arr +015: x := r.x; +016: x := a.x; + LINE (16:10) ** TYPE ERROR: Assignable Assign Expression - Object x of type integer != Object undefined of type undefined + LINE (16:9) ** TYPE ERROR: Invalid type passed to record access +017: +018: return 0; +019: } diff --git a/tests/sprint3/expected/sp3_integer_binary_op_typecheck.expected b/tests/sprint3/expected/sp3_integer_binary_op_typecheck.expected deleted file mode 100644 index 0b4c83f..0000000 --- a/tests/sprint3/expected/sp3_integer_binary_op_typecheck.expected +++ /dev/null @@ -1,25 +0,0 @@ -001: type main: string -> integer -002: -003: type rec: [integer: x; integer: y] -004: function entry: main -005: -006: entry (arg) := { -007: [integer:x; address: arr; address: arr2; Boolean : b2; Boolean : b1; character : a; rec : r] -008: -009: x := 3 + 2 * 8; -010: x := 3 - 2 / 8; -011: x := a * 2 % 8; - LINE (11:20) ** TYPE ERROR: x != undefined - -012: b2 := 3 * 2 % 8; -013: x := 3 % 2 * 8; -014: x := 3 + arr - 8; - LINE (14:22) ** TYPE ERROR: x != undefined - -015: x := r.x; - LINE (15:10) ** TYPE ERROR: x != r - -016: x := a.x; -017: -018: return 0; -019: } diff --git a/tests/sprint3/expected/sp3_integer_unary_op_typecheck.expected b/tests/sprint3/expected/sp3_integer_unary_op_typecheck.asc.exp similarity index 53% rename from tests/sprint3/expected/sp3_integer_unary_op_typecheck.expected rename to tests/sprint3/expected/sp3_integer_unary_op_typecheck.asc.exp index 18bd5a7..0ed98b5 100644 --- a/tests/sprint3/expected/sp3_integer_unary_op_typecheck.expected +++ b/tests/sprint3/expected/sp3_integer_unary_op_typecheck.asc.exp @@ -6,8 +6,8 @@ 006: 007: x := -8; 008: x := -b1; - LINE (8:10) ** TYPE ERROR: x != undefined - + LINE (8:10) ** TYPE ERROR: Assignable Assign Expression - Object x of type integer != Object undefined of type undefined + LINE (8:10) ** TYPE ERROR: Object b1 of type Boolean is not of type integer and can't be negated 009: b2 := -x; 010: 011: return 0; diff --git a/tests/sprint3/expected/sp3_multiple_args.asc.exp b/tests/sprint3/expected/sp3_multiple_args.asc.exp new file mode 100644 index 0000000..ffd92c2 --- /dev/null +++ b/tests/sprint3/expected/sp3_multiple_args.asc.exp @@ -0,0 +1,23 @@ +001: type rec: [character: x; integer: y] +002: +003: type T2: rec -> integer +004: +005: type main: string -> integer +006: function entry: main +007: function bar: T2 +008: +009: bar (r,s) := { +010: return 0; +011: } +012: +013: entry (arg) := { +014: [ integer: result ; rec: w] +015: while ( result = result ) { +016: while ( result < w.y ) { +017: result := 8; +018: } +019: result := 9; +020: } +021: result := bar('c', 7); +022: return 0; +023: } diff --git a/tests/sprint3/expected/sp3_multiple_args.expected b/tests/sprint3/expected/sp3_multiple_args.expected deleted file mode 100644 index c0128e1..0000000 --- a/tests/sprint3/expected/sp3_multiple_args.expected +++ /dev/null @@ -1,25 +0,0 @@ -NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION : -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -bar : 001001 : : undefined : Function Definition -entry : 001001 : : undefined : Function Definition -main : 001001 : : string -> integer : Type of Function -T2 : 001001 : : rec -> integer : Type of Function -rec : 001001 : : Record Type : elements-2 size-6 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 -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 : 013000 : 001001 : rec : Record Instance -result : 013000 : 001001 : integer : Primitive Instance -arg : 013000 : 001001 : string : Array Instance -------------------------------:--------:--------:-----------------------------------:-----------------------------------: - : 009000 : 001001 : : Empty Scope -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -y : 001000 : 001001 : integer : Primitive Instance -x : 001000 : 001001 : character : Primitive Instance diff --git a/tests/sprint3/expected/sp3_primitive_type_check.asc.exp b/tests/sprint3/expected/sp3_primitive_type_check.asc.exp new file mode 100644 index 0000000..7afd2a4 --- /dev/null +++ b/tests/sprint3/expected/sp3_primitive_type_check.asc.exp @@ -0,0 +1,23 @@ +001: (* +002: Testing the following type checks: +003: - integer : primitive +004: - character : primitive +005: - boolean : primitive +006: +007: - address (not included, special case) +008: *) +009: +010: +011: +012: type main: string -> integer +013: function entry: main +014: +015: entry (arg) := { +016: [integer: i; address: add; character: char; Boolean: bool] +017: +018: i := 3 + 2 * 8; +019: char := 'a'; +020: bool := true; +021: +022: return 0; +023: } diff --git a/tests/sprint3/expected/sp3_record_size_check.asc.exp b/tests/sprint3/expected/sp3_record_size_check.asc.exp new file mode 100644 index 0000000..2b5700c --- /dev/null +++ b/tests/sprint3/expected/sp3_record_size_check.asc.exp @@ -0,0 +1,3 @@ +001: type tom : [integer : x; integer: y] +002: type rec : [integer : x; tom : prev; character : c; character : d; Boolean: b; integer : y] +003: type tricky : [Boolean : b1; integer : k1; Boolean : b2; integer : k2] \ No newline at end of file diff --git a/tests/sprint3/expected/sp3_record_size_check.expected b/tests/sprint3/expected/sp3_record_size_check.expected deleted file mode 100644 index a061979..0000000 --- a/tests/sprint3/expected/sp3_record_size_check.expected +++ /dev/null @@ -1,29 +0,0 @@ -NAME : SCOPE : PARENT : TYPE : EXTRA ANNOTATION : -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -tricky : 001001 : : Record Type : elements-4 size-16 bytes -rec : 001001 : : Record Type : elements-6 size-24 bytes -tom : 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 -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 -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -k2 : 003000 : 001001 : integer : Primitive Instance -b2 : 003000 : 001001 : Boolean : Primitive Instance -k1 : 003000 : 001001 : integer : Primitive Instance -b1 : 003000 : 001001 : Boolean : Primitive Instance -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -y : 002000 : 001001 : integer : Primitive Instance -b : 002000 : 001001 : Boolean : Primitive Instance -d : 002000 : 001001 : character : Primitive Instance -c : 002000 : 001001 : character : Primitive Instance -prev : 002000 : 001001 : tom : Record Instance -x : 002000 : 001001 : integer : Primitive Instance -------------------------------:--------:--------:-----------------------------------:-----------------------------------: -y : 001000 : 001001 : integer : Primitive Instance -x : 001000 : 001001 : integer : Primitive Instance diff --git a/tests/sprint3/test/sp3_and_or_type_check.alpha b/tests/sprint3/test/sp3_and_or_type_check.alpha index c01fc10..63c9f62 100644 --- a/tests/sprint3/test/sp3_and_or_type_check.alpha +++ b/tests/sprint3/test/sp3_and_or_type_check.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type rec: [integer: x; integer: y] type main: rec -> integer function test: main diff --git a/tests/sprint3/test/sp3_boolean_binary_op_typecheck.alpha b/tests/sprint3/test/sp3_boolean_binary_op_typecheck.alpha index 538d982..53ef65c 100644 --- a/tests/sprint3/test/sp3_boolean_binary_op_typecheck.alpha +++ b/tests/sprint3/test/sp3_boolean_binary_op_typecheck.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type main: string -> integer function entry: main diff --git a/tests/sprint3/test/sp3_boolean_unary_op_typecheck.alpha b/tests/sprint3/test/sp3_boolean_unary_op_typecheck.alpha index 6a23ff6..d099993 100644 --- a/tests/sprint3/test/sp3_boolean_unary_op_typecheck.alpha +++ b/tests/sprint3/test/sp3_boolean_unary_op_typecheck.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type main: string -> integer function entry: main diff --git a/tests/sprint3/test/sp3_carls_second_mistake.alpha b/tests/sprint3/test/sp3_carls_second_mistake.alpha index ddb58a4..652dc48 100644 --- a/tests/sprint3/test/sp3_carls_second_mistake.alpha +++ b/tests/sprint3/test/sp3_carls_second_mistake.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type main: string -> integer function entry: main diff --git a/tests/sprint3/test/sp3_if_else.alpha b/tests/sprint3/test/sp3_if_else.alpha index 02c9525..e8f4bd7 100644 --- a/tests/sprint3/test/sp3_if_else.alpha +++ b/tests/sprint3/test/sp3_if_else.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type rec: [character: x; integer: y] type T2: rec -> integer diff --git a/tests/sprint3/test/sp3_if_while.alpha b/tests/sprint3/test/sp3_if_while.alpha index bb6a519..45300bc 100644 --- a/tests/sprint3/test/sp3_if_while.alpha +++ b/tests/sprint3/test/sp3_if_while.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type rec: [character: x; integer: y] type T2: rec -> integer diff --git a/tests/sprint3/test/sp3_integer_binary_op_typecheck.alpha b/tests/sprint3/test/sp3_integer_binary_op_typecheck.alpha index 2adb394..71bb0e5 100644 --- a/tests/sprint3/test/sp3_integer_binary_op_typecheck.alpha +++ b/tests/sprint3/test/sp3_integer_binary_op_typecheck.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type main: string -> integer type rec: [integer: x; integer: y] diff --git a/tests/sprint3/test/sp3_integer_unary_op_typecheck.alpha b/tests/sprint3/test/sp3_integer_unary_op_typecheck.alpha index 7ab6817..3469bb6 100644 --- a/tests/sprint3/test/sp3_integer_unary_op_typecheck.alpha +++ b/tests/sprint3/test/sp3_integer_unary_op_typecheck.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type main: string -> integer function entry: main diff --git a/tests/sprint3/test/sp3_multiple_args.alpha b/tests/sprint3/test/sp3_multiple_args.alpha index f069230..6cd4144 100644 --- a/tests/sprint3/test/sp3_multiple_args.alpha +++ b/tests/sprint3/test/sp3_multiple_args.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type rec: [character: x; integer: y] type T2: rec -> integer diff --git a/tests/sprint3/test/sp3_primitive_type_check.alpha b/tests/sprint3/test/sp3_primitive_type_check.alpha index 6980aba..9a078ad 100644 --- a/tests/sprint3/test/sp3_primitive_type_check.alpha +++ b/tests/sprint3/test/sp3_primitive_type_check.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) (* Testing the following type checks: - integer : primitive diff --git a/tests/sprint3/test/sp3_record_size_check.alpha b/tests/sprint3/test/sp3_record_size_check.alpha index 8e123d0..d8526d5 100644 --- a/tests/sprint3/test/sp3_record_size_check.alpha +++ b/tests/sprint3/test/sp3_record_size_check.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc] *) type tom : [integer : x; integer: y] type rec : [integer : x; tom : prev; character : c; character : d; Boolean: b; integer : y] type tricky : [Boolean : b1; integer : k1; Boolean : b2; integer : k2] \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_add.asc.exp b/tests/sprint4/expected/sp4_cg_add.asc.exp new file mode 100644 index 0000000..bff5d97 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_add.asc.exp @@ -0,0 +1,10 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [integer:x; integer:y] +006: y := 1; +007: x := 3; +008: y := x + y; +009: return y; +010: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_add.ir.exp b/tests/sprint4/expected/sp4_cg_add.ir.exp new file mode 100644 index 0000000..d0a05ab --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_add.ir.exp @@ -0,0 +1,8 @@ + 1: func : test + 2: $t0 = 1 + 3: y = $t0 + 4: $t1 = 3 + 5: x = $t1 + 6: $t2 = x + y + 7: y = $t2 + 8: return : y diff --git a/tests/sprint4/expected/sp4_cg_add.expected b/tests/sprint4/expected/sp4_cg_add.s.exp similarity index 100% rename from tests/sprint4/expected/sp4_cg_add.expected rename to tests/sprint4/expected/sp4_cg_add.s.exp diff --git a/tests/sprint4/expected/sp4_cg_and.asc.exp b/tests/sprint4/expected/sp4_cg_and.asc.exp new file mode 100644 index 0000000..8676177 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_and.asc.exp @@ -0,0 +1,10 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [Boolean:b; Boolean: c; Boolean: d] +006: c := true; +007: d := false; +008: d := c & d; +009: return 1; +010: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_and.expected b/tests/sprint4/expected/sp4_cg_and.expected deleted file mode 100644 index be6a53e..0000000 --- a/tests/sprint4/expected/sp4_cg_and.expected +++ /dev/null @@ -1,20 +0,0 @@ - movl $-1, -4(%rbp) #constant assign - movl -4(%rbp), %eax #assign start - movl %eax, -8(%rbp) #assign end - movl $-1, -12(%rbp) #constant assign - movl -12(%rbp), %eax #assign start - movl %eax, -16(%rbp) #assign end - cmpl $0, -8(%rbp) #start and - je .L1or2 - cmpl $0, -16(%rbp) - je .L1or2 - movl $1, %eax - jmp .L1or3 -.L1or2: - movl $0, %eax -.L1or3: - movb %al, -20(%rbp) - andb $1, -20(%rbp) #and end - movl -20(%rbp), %eax #assign start - movl %eax, -16(%rbp) #assign end - movl $1, -24(%rbp) #constant assign diff --git a/tests/sprint4/expected/sp4_cg_and.ir.exp b/tests/sprint4/expected/sp4_cg_and.ir.exp new file mode 100644 index 0000000..462a6ad --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_and.ir.exp @@ -0,0 +1,9 @@ + 1: func : test + 2: $t0 = true + 3: c = $t0 + 4: $t1 = false + 5: d = $t1 + 6: $t2 = c & d + 7: d = $t2 + 8: $t3 = 1 + 9: return : $t3 diff --git a/tests/sprint4/expected/sp4_cg_and.s.exp b/tests/sprint4/expected/sp4_cg_and.s.exp new file mode 100644 index 0000000..0a3128d --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_and.s.exp @@ -0,0 +1,20 @@ + movl $-1, -1(%rbp) #constant assign + movl -1(%rbp), %eax #assign start + movl %eax, -2(%rbp) #assign end + movl $-1, -3(%rbp) #constant assign + movl -3(%rbp), %eax #assign start + movl %eax, -4(%rbp) #assign end + cmpl $0, -2(%rbp) #start and + je .L1or2 + cmpl $0, -4(%rbp) + je .L1or2 + movl $1, %eax + jmp .L1or3 +.L1or2: + movl $0, %eax +.L1or3: + movb %al, -5(%rbp) + andb $1, -5(%rbp) #and end + movl -5(%rbp), %eax #assign start + movl %eax, -4(%rbp) #assign end + movl $1, -9(%rbp) #constant assign diff --git a/tests/sprint4/expected/sp4_cg_div.asc.exp b/tests/sprint4/expected/sp4_cg_div.asc.exp new file mode 100644 index 0000000..87b68f2 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_div.asc.exp @@ -0,0 +1,10 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [integer:x; integer:y] +006: y := 1; +007: x := 3; +008: y := x / y; +009: return y; +010: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_div.ir.exp b/tests/sprint4/expected/sp4_cg_div.ir.exp new file mode 100644 index 0000000..905d038 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_div.ir.exp @@ -0,0 +1,8 @@ + 1: func : test + 2: $t0 = 1 + 3: y = $t0 + 4: $t1 = 3 + 5: x = $t1 + 6: $t2 = x / y + 7: y = $t2 + 8: return : y diff --git a/tests/sprint4/expected/sp4_cg_div.expected b/tests/sprint4/expected/sp4_cg_div.s.exp similarity index 100% rename from tests/sprint4/expected/sp4_cg_div.expected rename to tests/sprint4/expected/sp4_cg_div.s.exp diff --git a/tests/sprint4/expected/sp4_cg_equal_to.asc.exp b/tests/sprint4/expected/sp4_cg_equal_to.asc.exp new file mode 100644 index 0000000..df0cbd5 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_equal_to.asc.exp @@ -0,0 +1,10 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [Boolean: b; integer: x; integer: y] +006: x := 1; +007: y := 2; +008: b := x = y; +009: return 1; +010: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_equal_to.ir.exp b/tests/sprint4/expected/sp4_cg_equal_to.ir.exp new file mode 100644 index 0000000..1739814 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_equal_to.ir.exp @@ -0,0 +1,10 @@ + 1: func : test + 2: $t0 = 1 + 3: x = $t0 + 4: $t1 = 2 + 5: y = $t1 + 6: if ( x = y ) GOTO 0 + 7: GOTO : 0 + 8: b = $t2 + 9: $t3 = 1 + 10: return : $t3 diff --git a/tests/sprint4/expected/sp4_cg_equal_to.expected b/tests/sprint4/expected/sp4_cg_equal_to.s.exp similarity index 66% rename from tests/sprint4/expected/sp4_cg_equal_to.expected rename to tests/sprint4/expected/sp4_cg_equal_to.s.exp index e29c6c1..5f73e0b 100644 --- a/tests/sprint4/expected/sp4_cg_equal_to.expected +++ b/tests/sprint4/expected/sp4_cg_equal_to.s.exp @@ -7,7 +7,5 @@ movl -8(%rbp), %eax #equal to start cmpl -16(%rbp), %eax sete %al - movb %al, -20(%rbp) #equal to end - movl -20(%rbp), %eax #assign start - movl %eax, -24(%rbp) #assign end - movl $1, -28(%rbp) #constant assign + movb %al, -15(%rbp) #equal to end + movl $1, -20(%rbp) #constant assign diff --git a/tests/sprint4/expected/sp4_cg_less_than.asc.exp b/tests/sprint4/expected/sp4_cg_less_than.asc.exp new file mode 100644 index 0000000..63b0136 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_less_than.asc.exp @@ -0,0 +1,10 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [Boolean: b; integer: x; integer: y] +006: x := 1; +007: y := 2; +008: b := x < y; +009: return 1; +010: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_less_than.ir.exp b/tests/sprint4/expected/sp4_cg_less_than.ir.exp new file mode 100644 index 0000000..5feb329 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_less_than.ir.exp @@ -0,0 +1,10 @@ + 1: func : test + 2: $t0 = 1 + 3: x = $t0 + 4: $t1 = 2 + 5: y = $t1 + 6: if ( x < y ) GOTO 0 + 7: GOTO : 0 + 8: b = $t2 + 9: $t3 = 1 + 10: return : $t3 diff --git a/tests/sprint4/expected/sp4_cg_less_than.expected b/tests/sprint4/expected/sp4_cg_less_than.s.exp similarity index 66% rename from tests/sprint4/expected/sp4_cg_less_than.expected rename to tests/sprint4/expected/sp4_cg_less_than.s.exp index b8d8904..4ed5ad1 100644 --- a/tests/sprint4/expected/sp4_cg_less_than.expected +++ b/tests/sprint4/expected/sp4_cg_less_than.s.exp @@ -7,7 +7,5 @@ movl -8(%rbp), %eax #less than start cmpl -16(%rbp), %eax setl %al - movb %al, -20(%rbp) #less than end - movl -20(%rbp), %eax #assign start - movl %eax, -24(%rbp) #assign end - movl $1, -28(%rbp) #constant assign + movb %al, -15(%rbp) #less than end + movl $1, -20(%rbp) #constant assign diff --git a/tests/sprint4/expected/sp4_cg_mod.asc.exp b/tests/sprint4/expected/sp4_cg_mod.asc.exp new file mode 100644 index 0000000..32294ec --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_mod.asc.exp @@ -0,0 +1,10 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [integer:x; integer:y] +006: y := 1; +007: x := 3; +008: y := x % y; +009: return y; +010: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_mod.ir.exp b/tests/sprint4/expected/sp4_cg_mod.ir.exp new file mode 100644 index 0000000..b16f1de --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_mod.ir.exp @@ -0,0 +1,8 @@ + 1: func : test + 2: $t0 = 1 + 3: y = $t0 + 4: $t1 = 3 + 5: x = $t1 + 6: $t2 = x % y + 7: y = $t2 + 8: return : y diff --git a/tests/sprint4/expected/sp4_cg_mod.expected b/tests/sprint4/expected/sp4_cg_mod.s.exp similarity index 100% rename from tests/sprint4/expected/sp4_cg_mod.expected rename to tests/sprint4/expected/sp4_cg_mod.s.exp diff --git a/tests/sprint4/expected/sp4_cg_mult.asc.exp b/tests/sprint4/expected/sp4_cg_mult.asc.exp new file mode 100644 index 0000000..15138ee --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_mult.asc.exp @@ -0,0 +1,10 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [integer:x; integer:y] +006: y := 1; +007: x := 3; +008: y := x * x; +009: return y; +010: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_mult.ir.exp b/tests/sprint4/expected/sp4_cg_mult.ir.exp new file mode 100644 index 0000000..c125e68 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_mult.ir.exp @@ -0,0 +1,8 @@ + 1: func : test + 2: $t0 = 1 + 3: y = $t0 + 4: $t1 = 3 + 5: x = $t1 + 6: $t2 = x * x + 7: y = $t2 + 8: return : y diff --git a/tests/sprint4/expected/sp4_cg_mult.expected b/tests/sprint4/expected/sp4_cg_mult.s.exp similarity index 100% rename from tests/sprint4/expected/sp4_cg_mult.expected rename to tests/sprint4/expected/sp4_cg_mult.s.exp diff --git a/tests/sprint4/expected/sp4_cg_neg.asc.exp b/tests/sprint4/expected/sp4_cg_neg.asc.exp new file mode 100644 index 0000000..647d812 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_neg.asc.exp @@ -0,0 +1,9 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [integer:x; integer:y] +006: x := 3; +007: y := -x; +008: return y; +009: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_neg.ir.exp b/tests/sprint4/expected/sp4_cg_neg.ir.exp new file mode 100644 index 0000000..6a42a7c --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_neg.ir.exp @@ -0,0 +1,6 @@ + 1: func : test + 2: $t0 = 3 + 3: x = $t0 + 4: $t1 = -x + 5: y = $t1 + 6: return : y diff --git a/tests/sprint4/expected/sp4_cg_neg.expected b/tests/sprint4/expected/sp4_cg_neg.s.exp similarity index 100% rename from tests/sprint4/expected/sp4_cg_neg.expected rename to tests/sprint4/expected/sp4_cg_neg.s.exp diff --git a/tests/sprint4/expected/sp4_cg_not.asc.exp b/tests/sprint4/expected/sp4_cg_not.asc.exp new file mode 100644 index 0000000..ac22520 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_not.asc.exp @@ -0,0 +1,9 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [Boolean: c; Boolean: d] +006: c := true; +007: d := !c; +008: return 1; +009: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_not.expected b/tests/sprint4/expected/sp4_cg_not.expected deleted file mode 100644 index b2e4bda..0000000 --- a/tests/sprint4/expected/sp4_cg_not.expected +++ /dev/null @@ -1,13 +0,0 @@ - movl $-1, -4(%rbp) #constant assign - movl -4(%rbp), %eax #assign start - movl %eax, -8(%rbp) #assign end - movzbl -8(%rbp), %eax #not start - testl %eax, %eax - setne %al - xorl $1, %eax - movzbl %al, %eax - movb %al, -12(%rbp) - andb $1, -12(%rbp) #not end - movl -12(%rbp), %eax #assign start - movl %eax, -16(%rbp) #assign end - movl $1, -20(%rbp) #constant assign diff --git a/tests/sprint4/expected/sp4_cg_not.ir.exp b/tests/sprint4/expected/sp4_cg_not.ir.exp new file mode 100644 index 0000000..f1b6d6b --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_not.ir.exp @@ -0,0 +1,7 @@ + 1: func : test + 2: $t0 = true + 3: c = $t0 + 4: $t1 = !c + 5: d = $t1 + 6: $t2 = 1 + 7: return : $t2 diff --git a/tests/sprint4/expected/sp4_cg_not.s.exp b/tests/sprint4/expected/sp4_cg_not.s.exp new file mode 100644 index 0000000..39c04ce --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_not.s.exp @@ -0,0 +1,13 @@ + movl $-1, -1(%rbp) #constant assign + movl -1(%rbp), %eax #assign start + movl %eax, -2(%rbp) #assign end + movzbl -2(%rbp), %eax #not start + testl %eax, %eax + setne %al + xorl $1, %eax + movzbl %al, %eax + movb %al, -3(%rbp) + andb $1, -3(%rbp) #not end + movl -3(%rbp), %eax #assign start + movl %eax, -4(%rbp) #assign end + movl $1, -8(%rbp) #constant assign diff --git a/tests/sprint4/expected/sp4_cg_or.asc.exp b/tests/sprint4/expected/sp4_cg_or.asc.exp new file mode 100644 index 0000000..5a99180 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_or.asc.exp @@ -0,0 +1,10 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [Boolean:b; Boolean: c; Boolean: d] +006: c := true; +007: d := false; +008: d := c | d; +009: return 1; +010: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_or.expected b/tests/sprint4/expected/sp4_cg_or.expected deleted file mode 100644 index 120058f..0000000 --- a/tests/sprint4/expected/sp4_cg_or.expected +++ /dev/null @@ -1,21 +0,0 @@ - movl $-1, -4(%rbp) #constant assign - movl -4(%rbp), %eax #assign start - movl %eax, -8(%rbp) #assign end - movl $-1, -12(%rbp) #constant assign - movl -12(%rbp), %eax #assign start - movl %eax, -16(%rbp) #assign end - cmpl $0, -8(%rbp) #start or - jne .L1or2 - cmpl $0, -16(%rbp) - je .L1or3 -.L1or2: - movl $1, %eax - jmp .L1or4 -.L1or3: - movl $0, %eax -.L1or4: - movb %al, -20(%rbp) - andb $1, -20(%rbp) #or end - movl -20(%rbp), %eax #assign start - movl %eax, -16(%rbp) #assign end - movl $1, -24(%rbp) #constant assign diff --git a/tests/sprint4/expected/sp4_cg_or.ir.exp b/tests/sprint4/expected/sp4_cg_or.ir.exp new file mode 100644 index 0000000..5dfac99 --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_or.ir.exp @@ -0,0 +1,9 @@ + 1: func : test + 2: $t0 = true + 3: c = $t0 + 4: $t1 = false + 5: d = $t1 + 6: $t2 = c | d + 7: d = $t2 + 8: $t3 = 1 + 9: return : $t3 diff --git a/tests/sprint4/expected/sp4_cg_or.s.exp b/tests/sprint4/expected/sp4_cg_or.s.exp new file mode 100644 index 0000000..7faecdd --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_or.s.exp @@ -0,0 +1,21 @@ + movl $-1, -1(%rbp) #constant assign + movl -1(%rbp), %eax #assign start + movl %eax, -2(%rbp) #assign end + movl $-1, -3(%rbp) #constant assign + movl -3(%rbp), %eax #assign start + movl %eax, -4(%rbp) #assign end + cmpl $0, -2(%rbp) #start or + jne .L1or2 + cmpl $0, -4(%rbp) + je .L1or3 +.L1or2: + movl $1, %eax + jmp .L1or4 +.L1or3: + movl $0, %eax +.L1or4: + movb %al, -5(%rbp) + andb $1, -5(%rbp) #or end + movl -5(%rbp), %eax #assign start + movl %eax, -4(%rbp) #assign end + movl $1, -9(%rbp) #constant assign diff --git a/tests/sprint4/expected/sp4_cg_sub.asc.exp b/tests/sprint4/expected/sp4_cg_sub.asc.exp new file mode 100644 index 0000000..4b4496c --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_sub.asc.exp @@ -0,0 +1,10 @@ +001: type main: integer -> integer +002: function test: main +003: +004: test (a) := { +005: [integer:x; integer:y] +006: y := 1; +007: x := 3; +008: y := x - y; +009: return y; +010: } \ No newline at end of file diff --git a/tests/sprint4/expected/sp4_cg_sub.ir.exp b/tests/sprint4/expected/sp4_cg_sub.ir.exp new file mode 100644 index 0000000..c4ef79a --- /dev/null +++ b/tests/sprint4/expected/sp4_cg_sub.ir.exp @@ -0,0 +1,8 @@ + 1: func : test + 2: $t0 = 1 + 3: y = $t0 + 4: $t1 = 3 + 5: x = $t1 + 6: $t2 = x - y + 7: y = $t2 + 8: return : y diff --git a/tests/sprint4/expected/sp4_cg_sub.expected b/tests/sprint4/expected/sp4_cg_sub.s.exp similarity index 100% rename from tests/sprint4/expected/sp4_cg_sub.expected rename to tests/sprint4/expected/sp4_cg_sub.s.exp diff --git a/tests/sprint4/test/sp4_cg_add.alpha b/tests/sprint4/test/sp4_cg_add.alpha index f4f8138..0398f89 100644 --- a/tests/sprint4/test/sp4_cg_add.alpha +++ b/tests/sprint4/test/sp4_cg_add.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_and.alpha b/tests/sprint4/test/sp4_cg_and.alpha index 5017e35..97adf47 100644 --- a/tests/sprint4/test/sp4_cg_and.alpha +++ b/tests/sprint4/test/sp4_cg_and.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_div.alpha b/tests/sprint4/test/sp4_cg_div.alpha index 32d3537..e6f9cbd 100644 --- a/tests/sprint4/test/sp4_cg_div.alpha +++ b/tests/sprint4/test/sp4_cg_div.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_equal_to.alpha b/tests/sprint4/test/sp4_cg_equal_to.alpha index a3da50c..23ecf91 100644 --- a/tests/sprint4/test/sp4_cg_equal_to.alpha +++ b/tests/sprint4/test/sp4_cg_equal_to.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_less_than.alpha b/tests/sprint4/test/sp4_cg_less_than.alpha index 8f41ced..a1e6bbb 100644 --- a/tests/sprint4/test/sp4_cg_less_than.alpha +++ b/tests/sprint4/test/sp4_cg_less_than.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_mod.alpha b/tests/sprint4/test/sp4_cg_mod.alpha index 1b579d5..ccf0b85 100644 --- a/tests/sprint4/test/sp4_cg_mod.alpha +++ b/tests/sprint4/test/sp4_cg_mod.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_mult.alpha b/tests/sprint4/test/sp4_cg_mult.alpha index c151a6b..630fa14 100644 --- a/tests/sprint4/test/sp4_cg_mult.alpha +++ b/tests/sprint4/test/sp4_cg_mult.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_neg.alpha b/tests/sprint4/test/sp4_cg_neg.alpha index 345980b..58683a4 100644 --- a/tests/sprint4/test/sp4_cg_neg.alpha +++ b/tests/sprint4/test/sp4_cg_neg.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_not.alpha b/tests/sprint4/test/sp4_cg_not.alpha index 40252f9..f7ad95c 100644 --- a/tests/sprint4/test/sp4_cg_not.alpha +++ b/tests/sprint4/test/sp4_cg_not.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_or.alpha b/tests/sprint4/test/sp4_cg_or.alpha index b6d6766..0ce14f3 100644 --- a/tests/sprint4/test/sp4_cg_or.alpha +++ b/tests/sprint4/test/sp4_cg_or.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main diff --git a/tests/sprint4/test/sp4_cg_sub.alpha b/tests/sprint4/test/sp4_cg_sub.alpha index f280c9d..abf6608 100644 --- a/tests/sprint4/test/sp4_cg_sub.alpha +++ b/tests/sprint4/test/sp4_cg_sub.alpha @@ -1,3 +1,4 @@ +(* TEST: [-asc -tc -cg -ir] *) type main: integer -> integer function test: main