ContentsFoundations to FrontierBezhig

graduate_code/starters/compiler.py

All lab code. Download this file.

# Exercise scaffold. Reference implementation is in a separate directory.
"""GP1: pure expressions -> typed AST -> verified, forward-only bytecode.
This is an educational compiler, not a sandbox for hostile programs.
"""
import ast
import sys
from .language import infer, evaluate

def parse(source):
    raise NotImplementedError('Implement this contract from the book.')

def simplify(expression):
    raise NotImplementedError('Implement this contract from the book.')

def compile_expr(expression):
    raise NotImplementedError('Implement this contract from the book.')

def verify(code):
    """Abstractly execute all acyclic paths; intersect definitely assigned locals."""
    raise NotImplementedError('Implement this contract from the book.')

def run(code):
    raise NotImplementedError('Implement this contract from the book.')