simit-lang / simit

A language for computing on sparse systems
http://simit-lang.org
Other
456 stars 52 forks source link

Improved support for generics and refactored front end #6

Closed stephenchouca closed 8 years ago

stephenchouca commented 8 years ago

This set of changes adds support for explicitly passing generic arguments as part of a generic function call. (The updated syntax and semantics of generics in Simit can be found here.) For example, the following program is now legal in Simit:

func foo<N,M>(A : matrix[M,M](float)) -> (B : matrix[N,N](float))
   % ...
end

export func main()
   var A : matrix[5,5](float) = 0.0;
   % ...
   B = foo<6>(A);  % returns a matrix[6,6](float)
end

The front end has also been refactored so that classes and namespaces previously prefixed by "HIR" are now prefixed by "FIR" (short for "front-end IR") instead. Fixes for a number of minor bugs in the type checker are also included in this change set. Most of the non-trivial changes can be found in type_checker.cpp and parser.cpp.

stephenchouca commented 8 years ago

@fredrikbk Would you be able to take a look at this? Thanks.