parse

package
v0.0.0-...-a54c318 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assign

type Assign struct {
	Target *Var
	Val    Node
}

func (*Assign) String

func (a *Assign) String() string

func (*Assign) Type

func (a *Assign) Type() Type

type BinaryExpr

type BinaryExpr struct {
	Left  Node
	Op    lex.Kind
	Right Node
}

func (*BinaryExpr) String

func (b *BinaryExpr) String() string

func (*BinaryExpr) Type

func (b *BinaryExpr) Type() Type

type BoolLit

type BoolLit struct {
	Val bool
}

func (*BoolLit) String

func (n *BoolLit) String() string

func (*BoolLit) Type

func (n *BoolLit) Type() Type

type Decl

type Decl struct {
	Var *Var
}

func (*Decl) String

func (d *Decl) String() string

func (*Decl) Type

func (d *Decl) Type() Type

type GroupExpr

type GroupExpr struct {
	Expr Node
}

func (*GroupExpr) String

func (g *GroupExpr) String() string

func (*GroupExpr) Type

func (g *GroupExpr) Type() Type

type Node

type Node interface {
	String() string
	Type() Type
}

func ParseExpr

func ParseExpr(tokens []lex.Token, pratt bool) (n Node, err error)

type NumLit

type NumLit struct {
	Val float64
}

func (*NumLit) String

func (n *NumLit) String() string

func (*NumLit) Type

func (n *NumLit) Type() Type

type Prog

type Prog struct {
	Stmts []Node
}

func ParseProg

func ParseProg(tokens []lex.Token) (prog *Prog, err error)

func (*Prog) String

func (p *Prog) String() string

func (*Prog) Type

func (p *Prog) Type() Type

type StringLit

type StringLit struct {
	Val string
}

func (*StringLit) String

func (s *StringLit) String() string

func (*StringLit) Type

func (s *StringLit) Type() Type

type Type

type Type string
const (
	NumType    Type = "num"
	StringType Type = "string"
	BoolType   Type = "bool"
	NoneType   Type = "none"
)

func (Type) String

func (t Type) String() string

type UnaryExpr

type UnaryExpr struct {
	Op    lex.Kind
	Right Node
}

func (*UnaryExpr) String

func (u *UnaryExpr) String() string

func (*UnaryExpr) Type

func (u *UnaryExpr) Type() Type

type Var

type Var struct {
	Name string
	T    Type
}

func (*Var) String

func (v *Var) String() string

func (*Var) Type

func (v *Var) Type() Type

Jump to

Keyboard shortcuts

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