Skip to content

ZhekehZ/Supercompilation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Supercompilation

A simple positive supercompiler.

Usage:

make [tests | repl | sc | clean]

  • repl --- run Haskell interpreter
  • sc --- build executable
  • tests --- compile and run tests

Prerequirements:

  • ghc
  • make
  • Text.PrettyPrint module
  • Text.Parsec.* modules
  Term := V                                          -- variable
        | N                                          -- number
        | func(Term, ..., Term)                      -- builtin function
        | pred(Term, ..., Term)                      -- builtin predicate
        | Term Term                                  -- application
        | \V -> Term                                 -- lambda abstraction
        | Constructor(Term, ..., Term)               -- constructor
        | Function                                   -- function
        | let V = Term in Term                       -- let expresstion
        | case Term of { Con V ... V => Term; ... }  -- case expresstion

  Definition := V = Term                             -- function definition (name = body)
  Program := (V, Definition, ..., Definition)        -- program (entry point and functions)

Repl features