-
Notifications
You must be signed in to change notification settings - Fork 0
Noah-Terve/compiler
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The Wampus Compiler
Authors of the compiler:
Christopher Sasanuma - Christopher.Sasanuma@tufts.edu
Haijun Si - Haijun.Si@tufts.edu
Neil Powers - neil.powers@tufts.edu
Noah Tervalon - noah.tervalon@tufts.edu
To just compile our compiler run:
> `make`
Given a single source file written in your language, run your compiler on that file to generate
the executable and any intermediary files generated along the way.
To run our compiler on a source file written in our language, and generate all
intermediate files generated, run:
> `./compile.sh [.wam file] [executable name]`
To run all the tests and see the status of each, use:
> `make test`
You can then see the test log in: `testall.log`
You can use also the `testall.sh` script for more fine-grain control. Running with
`-h` will give the help menu, where you can get more info. Running with no
options and no test files will test all of our cases. Specifying a test file
will run only that test.
> `./testall.sh [options] [.wam files]`
Testing:
Our testing script validates that a program is correct by comparing the results
of running a test to a golden standard which we have created. For tests that are
supposed to pass they are .out files of the same name as the test. We validate
that a program that couldn't be compiled actually can't by comparing it to the
error that it is supposed to raise, which we have generated and stored in a
.err file.
We have a whole set of files which test the various parts of our language we have
implemented so far. They are noted below and seperated out by the different
things they test. All these files are stored in the tests/exec directory or one
of its subdirectories
Number of failing tests: 5
Number of passing tests: 20
Basic print tests, all in:
/tests/exec/basic_print/
test-print_int.wam - a simple file that prints 123
fail-print_int.wam - a file that tries to call print but gives it a bad argument
test-print_bool.wam - a simple file that prints out 1 for true and 0 for false
test-print_char.wam - a simple file that prints out a character
test-print_float.wam - a simple file that prints out a float
test-print_string.wam - a simple file that prints out hello world
Basic Binop Literal Tests, all in:
/tests/exec/print-binop/
test-print_alltypes.wam - a file that prints using all print function's of implemented types
test-print_float_binop.wam - a file that prints out all binops using float literals
test-print_float_int_arith.wam - a file that prints out float/int arithmetic
test-print_int_binop.wam - a file that prints out all binops using int literals
test-print_mod.wam - a file that prints out the mod binop
Basic Uop Literal Tests, all in:
/tests/exec/print-uop/
test-print_uop.wam - a file that prints out all implemented types using uops
Templated function tests, all in:
/tests/exec/templated_functions/
fail-nested_templates.wam - a templated function tries to access a template of an outer calling function
fail-templated_function.wam - tries to make a call with a template as a type passed in when the template doesn't exist (i.e. the template isn't inside a template block)
fail-wrong_number_of_args_for_template.wam - tries to make a call to a templated function but gives the wrong number of types to the template resolution
test-basic_types.wam - test a templated function with all pairs of basic types and print the results
test-nested_functions.wam - call a templated function from inside a templated function
Variable declaration and assignment, all in:
/tests/exec/variable_dec_assign/
test-dec-assign-in-block.wam - variable declaration and assignment in non-global scope
test-dec-assign.wam - variable declaration and assignment in global scope
test-dec-in-block.wam - variable declaration in non-global scope
test-dec.wam - variable declaration in global scope
Variable Scope tests, all in:
/tests/exec/variable_scope
fail-function-scope.wam - a function tries to use the local variables of the function that called it (not passed in as formal parameters)
test-f-args.wam - updating environment within an expression e.g. `f(x = x + 1)`
test-globals-in-blocks.wam - global variables should be accessible in all scopes
test-structparam.wam - testing structs as parameters
Control Flow tests, in:
/tests/exec/control_flow/
test-for-if1 - testing control flow with multiple levels of if statements
List tests, in:
/tests/exec/lists/
fail-insert.wam - attempts to insert a value into a list at an invalid index
fail-list-bad-types.wam - mismatch between variable and list
test-at.wam - access to first, center, and last elements of a list
test-insert.wam - insertion to first, center, and last index of a list
test-list-empty.wam - verifies you can create empty lists/sets and use them in expressions
test-list-length.wam - verifies that the length of a list is correct
test-list-mutability-in-structs.wam - ensures lists in structs are accessible and mutable
test-list-of-structs.wam - tests making and use of structs inside of lists
test-list-remove.wam - tests removing from the first, center, and last index of a list
test-list-scope.wam - tests lists mutability and scope by passing it around to different contexts
test-list.wam - tests declaration and assignment of lists in global and local scopes
test-more-lists.wam - lists of lists of lists and lists
test-nested-list.wam - tests list of lists (inc. empty lists)
test-replace.wam - tests replacement of first, center, and last index of a list
Overloading of functions tests, in:
/tests/exec/overloading_functions/
fail-basic_overloading.wam - Overloading two functions witth the same name and same parameter types
test-basic_overloading.wam - Overloading three functions with the same name and three different parameter types
Print debugging tests, in:
/tests/exec/print_debugging
nestedprint.wam - Testing printing an integer 5 in the function main
Struct tests, in:
/tests/exec/structs/
fail-struct_extrareference.wam - A struct access that tries to access another extra member vaariable
fail-struct_self_reference.wam - A struct that tries to refer to itself
test-basic_structs.wam - Test for declaring, accessing, and assign struct values
test-nested_structs.wam - Test for declaring, accessing, and assign nested struct values
test-nested_templated_structs.wam - Test for declaring, accessing, and assign nested and templated struct values
test-struct_instanciation_in_function.wam - Test that you can make a struct in a function and it works correctly
test-struct_self_reference_via_templating.wam - test that a struct can psudo reference itself via templating
test-templated_structs.wam - test a templated struct and setting it to struct literals
Set tests, in:
/tests/exec/sets/
test-set.wam - test that all the set functions are workin
test-empty.wam - test that empty sets are correctly typed
Random tests, in :
/tests/exec/random/
function_call.wam - test a basic function call
test-scope1.wam - test nested scope
test-whilebreak.wam - test break statements
test-whilecontinue.wam - test continue statements
About
Project for CS-107, Compilers.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published