Refal5 compiler for .NET platform
This is my spare-time project created for fun. I made fully-functional Refal5 compiler in a few days about a year ago, in June 2006. Once I discovered it recently among my old projects, I decided to publish its source on CodePlex. Although it is not yet complete,
it can compile and run most sample programs from standard Refal5 distribution. The main disadvantage of the current version is that the compiler don't handle recursion as the original Refal5 complier does, so large programs would crash with stack overflow.
- Supports base Refal syntax (functions, pattern matching, etc)
- Extended Refal5 syntax (where- and with-clauses)
- Compiles Refal to C# (could be easily extended to produce binary code)
- A few standard functions supported (Prout, Card, Open, etc)
- Intelligent recursion handling
- IL-code and binary assembly generation
- Pattern matching optimizations
- Visual Studio and/or MonoDevelop integration
- Debug information support
- .NET interoperability (via language extensions)
The current version of the compiler supports command-line interface.
Scanner and parser for Refal5.NET are generated with the use of
Coco/R Compiler Generator
. Parser uses CodeBuilder helper class to build the AST, which is then processed with the code generator. Code generator uses Visitor design pattern to generate plain C# code from AST nodes, and it could be easily extended to generate
IL-code or whatever. Compilation results are linked to a few utility classes (pattern matching, standard Refal5 RTL functions, etc) to produce an executable program. There are currently no utilities to handle build process automatically, so I had to write
bat-files for this purpose.