/superoptimizer

A superoptimizer implementation for a fictive programming language.

Primary LanguageCMIT LicenseMIT

🚀 superoptimizer

A superoptimizer implementation for a not-so fictive programming language called AG2 lang.

Overview

What's the idea? Really simple: optimize a -for now deterministic- program. A superoptimizer uses compiler theory algorithms to determine the best program that replicates the same output as the given program.

If you want to learn more about the subject, here are a couple of sources:

Examples

This program:

LOAD 77
SWAP 0 1
LOAD 8
XOR 0 1
SWAP 0 1
LOAD 0
SWAP 0 1

Is superoptimized as:

LOAD 69

Test the two using the ag2 compiler, I'm not lying! They have the exact same output.