types

package
v0.0.0-...-b6e707d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package types provides data structures for types in GoCaml.

Index

Constants

This section is empty.

Variables

View Source
var (
	UnitType   = &Unit{}
	BoolType   = &Bool{}
	IntType    = &Int{}
	FloatType  = &Float{}
	StringType = &String{}
)

Make singleton type values because it doesn't have any contextual information

Functions

This section is empty.

Types

type Array

type Array struct {
	Elem Type
}

func (*Array) String

func (t *Array) String() string

type Bool

type Bool struct {
}

func (*Bool) String

func (t *Bool) String() string

type Env

type Env struct {
	// Types for declarations. This is referred by type variables to resolve
	// type variables' actual types
	//
	// XXX:
	// Currently nested identifiers don't work. Example:
	//   let
	//     x = 42
	//   in
	//     let x = true in print_bool (x);
	//     print_int (x)
	// We need alpha transform before type inference in order to ensure
	// all symbol names are unique.
	Table map[string]Type
	// External variable names which are referred but not defined.
	// External variables are exposed as external symbols in other object files.
	Externals map[string]*External
}

Result of type analysis.

func NewEnv

func NewEnv() *Env

NewEnv creates empty Env instance.

func (*Env) Dump

func (env *Env) Dump()

func (*Env) DumpExternals

func (env *Env) DumpExternals()

type External

type External struct {
	Type  Type
	CName string
}

type Float

type Float struct {
}

func (*Float) String

func (t *Float) String() string

type Fun

type Fun struct {
	Ret    Type
	Params []Type
}

func (*Fun) String

func (t *Fun) String() string

type Int

type Int struct {
}

func (*Int) String

func (t *Int) String() string

type Option

type Option struct {
	Elem Type
}

func (*Option) String

func (t *Option) String() string

type String

type String struct {
}

func (*String) String

func (t *String) String() string

type Tuple

type Tuple struct {
	Elems []Type
}

func (*Tuple) String

func (t *Tuple) String() string

type Type

type Type interface {
	String() string
}

type Unit

type Unit struct {
}

func (*Unit) String

func (t *Unit) String() string

type Var

type Var struct {
	Ref Type
}

func (*Var) String

func (t *Var) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL