Skip to content

A parallel type analysis/inference system. New Mexico Tech CSE451 Project.

Notifications You must be signed in to change notification settings

tylercecil/Paratype

Repository files navigation

Paratype

A parallel type evaluation system. Paratype serves as a proof of concept for an actor model of type evaluation on a statically typed functional language.

Paratype is written in Google Go leveraging its shared memory message passing system.

Intro to Paratype by Example

Consider the following functions, where R, S, T, and U are type variables. The goal of Paratype is to find explicit sets of types for each of the functions. In this example, foo and baz will each have one set of explicit types, whereas bar will have two sets of explicit types.

func foo(T a, int b) int
	= bar(a, b)

func baz(S a, short b) float
	= bar(a, b)

func bar(int a, S b) R
	= R

This example should resolve to the following set of explicitly typed functions:

func foo(int a, int b) int
	= bar(a, b)

func baz(int a, short b) float
	= bar(a, b)

func bar(int a, int b) int
	= int

func bar(int a, short b) float
	= float

Of course, this is an unrealistic example of the average program: one must consider recursion and function composition, at which point the type evaluation becomes more complicated.

Testing

Merge Unit Tests

To be found in merge_test.go, run with

go test -v -run Name merge_test.go
  • Type by parent (works, see unit test named Down)
  • Type by child (works, see unit test named Up[0-3] where 0-2 with type errors)
  • Two parents with type (see unit test named Two)
  • Our favorite example (see unit test named Flow)

To run our favorite example:

go test -v -run Flow merge_test.go

Compilation

To set up Go, please visit http://golang.org/doc/install.

To compile Paratype:

go get https://github.com/skelterjohn/gopp
go build paratype.go

To list command line options for Paratype:

./paratype -h

The command line options are:

-infile=
    default: ""
    This command line option is necessary and an error will be thrown if it 
	is not present. 

-outfile=
	default: "" 
	This is necessary if the print flag is used. This is the file to print 
	the generated implementations to.

-print=
    default: false
    This determines whether to print the implementations to the given file
	or not.

-procs=
    default: 4
    This determines the number for GOMAXPROCS

-time=
	default: false
    This determines whether the time in nanoseconds should be gathered. 

You may find files to test in the testfiles directory. Please see known bugs in the report.

About

A parallel type analysis/inference system. New Mexico Tech CSE451 Project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published