GithubHelp home page GithubHelp logo

grouper's Introduction

Run all commands in the current directory.

Extended Testsuite:

Run all integraton tests with the command "make e2e_test"
    See "General Compilation Notes" below for the other compilation commands

Positive Integration Tests:

- Variable assignment and printing (in test/e2e/let-print.grp)
    Assigns to and prints a string varaible

- Nested Functions (in test/e2e/functions-nested.grp)
    Call a function which defines and calls another function inside its body

- Function parameters (in test/e2e/functions-param.grp)
    Call a function which takes another function as a parameter

- Function returns (in test/e2e/functions-return.grp)
    Call a function which returns another function, calling the result

- Function pointer assignment (in test/e2e/functions-assignment.grp)
    Assigns a function to a new name, calling that version of the function

- Structs (in test/e2e/struct.grp)
    Declares a struct type, initializes a struct, then prints the result of adding together
    two of the struct's fields

- Structs containing other constantly declared Structs (in test/e2e/struct-of-struct-const.grp)
    Intializes a struct with other structs as its fields and extracts the contents of an
    inner struct field 
- Struct equality (in test/e2e/struct_equality.grp)
    Uses == operator to compare if two structs are equal i.e. same struct type with same 
    values in fields

- Struct equality overload (in test/e2e/struct_eq_overload.grp)
    Uses == on structs after a field is instantiated

- Structs as parameters (in test/e2e/struct-as-param.grp)
    Declares a function that takes a struct as a parameter and calls that function passing
    a struct as an argument

- Initializing struct fields using variables (in test/e2e/struct-init-with-vars.grp)
    Declares variables and instantiates a struct setting fields equal those variables

- Field functions free (in test/e2e/field_fxn_free.grp)
    Calls a field function inside a different function to check if functions generated by field instantiation are free

- Field operator overload (in test/e2e/field_overload.grp)
    Instantiates a field of a non-primitive type and uses binary operators on members of 
    the field 

- Group operator overload (in test/e2e/group_overload.grp)
    Instantiates a group of a non-primitive type and uses binary operators on members of 
    the group

- List instantiation and extraction (in test/e2e/list.grp and test/e2e/list.grp)
    Instantiated a list and used car and cdr to extract specific elements from the list

- Matching on nested ADT's (in test/e2e/match-constructor-nested.grp)
    Instantiates a nested ADT and extracts the nested value using matching

- Matching on ADT using constant (in test/e2e/match-constructor-nested.grp)
    Instantiates an ADT with a value and matches using a constant 

- Matching on ADT's using variable (in test/e2e/match-constructor-nested.grp)
    Instantiates an ADT with a value and extracts the value using matching on a variable

- Matching on ADT's wildcard in constructor (in test/e2e/match-constructor-wildcard.grp)
    Matches the the constructor with a wildcard as the variable

- Matching on wildcard (in test/e2e/match-wildcard.grp)
    Matches a variable that fits no explicit case and matches on the wildcard case

- Nested If statements (in test/e2e/nested_if.grp)
    Nested if statements, put if in else case, called it to execute else case

- Nested Polynomial Plus in Rationals Field (in test/e2e/nested_pplus_frac.grp)
    Declared two polynomials of the fraction field and added them together

- Null check (in test/e2e/null.grp)
    Declares a singleton list and checks if the cdr of that list is null

- Operator overloading free in functions (in test/e2e/overload_free.grp)
    Declares a field of a non-primitive type and checks if operator overload
    is free in functions using binary operators on members of that field in a function

- Store and reference pairs in variables (in e2e/pair_var.grp)
    Stores a pair in a variable and uses cdr on the variable name to extract the second pair element

- Store structs in pairs (in test/e2e/pairs.grp)
    Stores two instances of a struct in a pair and extracts the structs from the pair

- Evaluate polynomials (in test/e2e/poly_eval.grp)
    Instantiates two polynomial over an Int field, gets the quotient and remainder from
     dividing them, gets the gcd of them, and finally evaluates a third different 
     polynomial with a specified input

-  Precedence test (in test/e2e/prec_test.grp)
    Checks for arithmetic order of operations

- Nesting prints (in test/e2e/print_nested.grp)
    Nests print calls to print the value returned by print

- Returning a pair from a function (in test/e2e/return_pair.grp)
    Declares a function that returns a pair and calls that function

- Ring check (in test/e2e/ring.grp)
    Instantiates an Int list ring and tests operator overloading and ring gcd




Semantically Negative Integration Tests:
- Type Mismatch (in test/e2e/let-mistmatch.fail.grp)
    Let binding where the declared type doesn't match the type of the supplied expression
        Specifically, binding a String to a variable declared as an Int
    Expect semantic failure for mismatched types

- Duplicate Function Names (in test/e2e/functions-duplicate.fail.grp)
    Two functions declared with the same name, but in different scopes
      ***Note: our language requires globally unique functions names, even if the declarations
         are in different scope
    Expect semantic failure for duplicate function names

- Incorrect Function Parameter (in test/e2e/functions-param-mismatch.fail.grp)
    Calls a function with a parameter of the wrong type
        Specifically, the function expects an Int, but a String is passed in
    Expect semantic failure for mismatched parameter type

- Not passing in the zero of a field into polynomial operation (in test/e2e/nested_pplus_over.fail.grp)
    Instantiates two polynomials over a fraction field and adds them without passing in the zero of the field as an argument

*** Note - every .grp test has a golden standard output stored in the corresponding .out file
All of these (.grp and .out) files are located in the directory test/e2e




General Compilation Notes:

Compile the Grouper Compiler into an executable with: 
    `make`
The executable is `./src/toplevel.native`
    
Clean the Grouper Compiler with:
    `make clean`

Run the Extended Testsuite with:
    `make e2e_test`
The output will be green if the test passes, and red otherwise

Compile a program and view all stages of compilation with:
    `make compile in=<Grouper source file>`
The AST is written to `ast.out`
The SAST is written to `sast.out`
The generated LLVM is written to `llvm.out`
The compiled, executable program is written to `out`

To compile with the standard library:
    `make with_stdlib in=<Grouper source file>`
This also outputs the intermediate files and executable stated above
The combined temporary source is stored in tmp/tmpsrc.grp

Compile Grouper source code with:
    `./src/toplevel.native (-a|-s|-l|-c) [filename.grp]`
    Compiler flags (one of 4 actions):
    `-a` prints out the AST
    `-s` prints out the SAST
    `-l` prints out the generated LLVM
    `-c` validates the generated LLVM and prints it out if it is valid 


Group members:
- Michael Simpson ([email protected])
- Robert Nooney ([email protected])
- Darren Tang ([email protected])

grouper's People

Contributors

kenziesimpson avatar darrentang26 avatar robbynooney avatar

Watchers

James Cloos avatar  avatar  avatar

grouper's Issues

Create parser

We need to divide up tasks for creating the parser

Validate types

We need to make sure that bound types are not ADT constructions to disallow constructions like APPLE x instead of Fruit x

Change naming system

We need to specify that variable names start lowercase, type names start uppercase, and ADT names are entirely uppercase

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.