SmaCC Transformation Toolkit methods
Scripts can define methods that can be called from other rewrite rules or methods. These methods are compiled on a specially created subclass of SmaCCRewriteMatchContext
and can be called by using self when evaluated in a rewrite match or method. As an example, in the Javascript conversion we compute the free variables that are used by the program or function and create a var Javascript statement. This code is the same so we can create a method that creates the var statement and call it from different locations: