PL-{GOTO}.NET ============= Version 1.2 Written by Chris Pressey of Cat's Eye Technologies. This work is hereby placed into the public domain. This Haskell module implements the programming language PL-{GOTO} from Brainerd and Landweber's _Theory of Computation_ (1974; ISBN 0471095850). PL-{GOTO} is a subset of the full language PL described in the book; it has had the GOTO instruction removed. The choice to implement this variant was made because it is computationally more interesting: PL-{GOTO} can express exactly the primitive recursive functions, and thus PL-{GOTO} programs always terminate. On the other hand, all algorithms that can run in nondeterminstic exponential time -- which includes almost all practical algorithms -- can be expressed primitive recursively (although their primitive recursive version may be drastically less efficient.) This module actually contains two implementations. There is an interpreter written in Haskell which evaluates PL-{GOTO} programs directly. In addition to this, there is a compiler which outputs MSIL code. This output can be fed into `ilasm` to produce an executable .NET assembly which performs the same computation as the PL-{GOTO} program -- thus the name PL-{GOTO}.NET. The compiler does no optimization whatsoever of the generated code. > {-# LANGUAGE FlexibleContexts #-} > module PLexceptGOTOdotNET where > import Text.ParserCombinators.Parsec > import qualified Data.Map as Map AST --- Grammar for the full (but not "extended") PL language, from the book: = A ∪ B ∪ ... ∪ Z = 0 ∪ 1 ∪ ... ∪ 9 = = ←0 ∪ +1 ∪ = ∪ GOTO