PackageDescription: DynamicCompiler


Dynamic Compiler

Last published: September 9, 2008 by 'tkogan'

Defines 2 Classes
Extends 2 Classes


This package provides special subclasses of Compiler and Parser which give the development environment the ability to dynamically switch between the language you're programming in based on detection of the kind of source code you're writing.

Subclasses of DynamicParser and DynamicCompiler implement #canParse: and #canCompile: respectively to determine what kind of parser/compiler combination is required to parse and compile the source code you've written. This allows a mixture of programming languages to be blended together on the one class, eg: Smalltalk, Javascript, CSS, C, etc.

Usually the detection is done on the method signature, since that is usually a big give away - but more sophisticated detection might attempt to parse the string to see if it can be parsed. The choice as to how this is achieved and resolving conflicts between languages is up to the implementors of the subclasses of the Dynamic Parsers/Compilers.

To enable your class to blend languages, simply set compilerClass and parserClass on the class side of your class to DynamicCompiler and DynamicParser respectively.