expr

package
v1.2.23 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String[S symbol.Symbol[S]](e Expr[S], mapping variable.Map[S]) string

String provides a generic facility for converting an expression into a suitable string.

func Uses

func Uses[S symbol.Symbol[S]](exprs ...Expr[S]) []variable.Id

Uses determines the (unique) set of registers read by any expression in the given set of expressions.

Types

type Add

type Add[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

Add represents an expression which adds one or more terms together.

func (*Add[S]) ExternUses

func (p *Add[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Add[S]) LocalUses

func (p *Add[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Add[S]) SetType

func (p *Add[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Add[S]) String

func (p *Add[S]) String(mapping variable.Map[S]) string

func (*Add[S]) Type

func (p *Add[S]) Type() data.Type[S]

Type implementation for Expr interface

type ArrayAccess

type ArrayAccess[S symbol.Symbol[S]] struct {
	Id       variable.Id
	Arg      Expr[S]
	Datatype data.Type[S]
}

ArrayAccess represents an array access within an expression.

func (*ArrayAccess[S]) ExternUses

func (p *ArrayAccess[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*ArrayAccess[S]) LocalUses

func (p *ArrayAccess[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*ArrayAccess[S]) SetType

func (p *ArrayAccess[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*ArrayAccess[S]) String

func (p *ArrayAccess[S]) String(mapping variable.Map[S]) string

func (*ArrayAccess[S]) Type

func (p *ArrayAccess[S]) Type() data.Type[S]

Type implementation for Expr interface

type BitwiseAnd

type BitwiseAnd[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

BitwiseAnd represents a bitwise-and of one or more terms.

func (*BitwiseAnd[S]) ExternUses

func (p *BitwiseAnd[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*BitwiseAnd[S]) LocalUses

func (p *BitwiseAnd[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*BitwiseAnd[S]) SetType

func (p *BitwiseAnd[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*BitwiseAnd[S]) String

func (p *BitwiseAnd[S]) String(mapping variable.Map[S]) string

func (*BitwiseAnd[S]) Type

func (p *BitwiseAnd[S]) Type() data.Type[S]

Type implementation for Expr interface

type BitwiseNot

type BitwiseNot[S symbol.Symbol[S]] struct {
	Expr Expr[S]
	// contains filtered or unexported fields
}

BitwiseNot represents a bitwise-not (complement) of a single expression.

func (*BitwiseNot[S]) ExternUses

func (p *BitwiseNot[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*BitwiseNot[S]) LocalUses

func (p *BitwiseNot[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*BitwiseNot[S]) SetType

func (p *BitwiseNot[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*BitwiseNot[S]) String

func (p *BitwiseNot[S]) String(mapping variable.Map[S]) string

func (*BitwiseNot[S]) Type

func (p *BitwiseNot[S]) Type() data.Type[S]

Type implementation for Expr interface

type BitwiseOr

type BitwiseOr[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

BitwiseOr represents a bitwise-or of one or more terms.

func (*BitwiseOr[S]) ExternUses

func (p *BitwiseOr[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*BitwiseOr[S]) LocalUses

func (p *BitwiseOr[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*BitwiseOr[S]) SetType

func (p *BitwiseOr[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*BitwiseOr[S]) String

func (p *BitwiseOr[S]) String(mapping variable.Map[S]) string

func (*BitwiseOr[S]) Type

func (p *BitwiseOr[S]) Type() data.Type[S]

Type implementation for Expr interface

type Cast

type Cast[S symbol.Symbol[S]] struct {
	Expr     Expr[S]
	CastType data.Type[S]
	// contains filtered or unexported fields
}

Cast represents a type cast expression of the form "e as T", which truncates the value of e to fit within the target type T.

func (*Cast[S]) ExternUses

func (p *Cast[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Cast[S]) LocalUses

func (p *Cast[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Cast[S]) SetType

func (p *Cast[S]) SetType(t data.Type[S])

SetType implementation for the Expr interface.

func (*Cast[S]) String

func (p *Cast[S]) String(mapping variable.Map[S]) string

String implementation for the Expr interface.

func (*Cast[S]) Type

func (p *Cast[S]) Type() data.Type[S]

Type implementation for the Expr interface.

type Cmp

type Cmp[S symbol.Symbol[S]] struct {
	// Operator indicates the condition
	Operator CmpOp
	// Left-hand side
	Left Expr[S]
	// Right-hand side
	Right Expr[S]
}

Cmp represents a comparison, such as "==", ">=", etc.

func NewCmp

func NewCmp[S symbol.Symbol[S]](op CmpOp, lhs, rhs Expr[S]) *Cmp[S]

NewCmp returns a freshly created comparison condition.

func (*Cmp[S]) ExternUses

func (p *Cmp[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Condition interface.

func (*Cmp[S]) LocalUses

func (p *Cmp[S]) LocalUses() bit.Set

LocalUses implementation for the Condition interface.

func (*Cmp[S]) Negate

func (p *Cmp[S]) Negate() Condition[S]

Negate implementation for Condition interface.

func (*Cmp[S]) SetType

func (p *Cmp[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Cmp[S]) String

func (p *Cmp[S]) String(env variable.Map[S]) string

func (*Cmp[S]) Type

func (p *Cmp[S]) Type() data.Type[S]

Type implementation for Expr interface

type CmpOp

type CmpOp uint8

CmpOp represents the set of possible operators for a comparison condition.

const (
	// EQ indicates an equality condition
	EQ CmpOp = 0
	// NEQ indicates a non-equality condition
	NEQ CmpOp = 1
	// LT indicates a less-than condition
	LT CmpOp = 2
	// GT indicates a greater-than condition
	GT CmpOp = 3
	// LTEQ indicates a less-than-or-equals condition
	LTEQ CmpOp = 4
	// GTEQ indicates a greater-than-or-equals condition
	GTEQ CmpOp = 5
)

func (CmpOp) Fieldable

func (p CmpOp) Fieldable() bool

Fieldable returns true for operators which are permitted on the field element type.

type Concat

type Concat[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

Concat represents an expresion which performs a bitwise concatenation of one (or more) expressions.

func (*Concat[S]) ExternUses

func (p *Concat[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Concat[S]) LocalUses

func (p *Concat[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Concat[S]) SetType

func (p *Concat[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Concat[S]) String

func (p *Concat[S]) String(mapping variable.Map[S]) string

func (*Concat[S]) Type

func (p *Concat[S]) Type() data.Type[S]

Type implementation for Expr interface

type Condition

type Condition[S symbol.Symbol[S]] interface {
	// Negate a given condition to produce an equivalent (but negated)
	// condition.
	Negate() Condition[S]
	// ExternUses returns the set of non-local declarations accessed by this
	// condition.  For example, external constants or memories used within.
	ExternUses() set.AnySortedSet[S]
	// RegistersRead returns the set of variables used (i.e. read) by this condition
	LocalUses() bit.Set
	// String returns a string representation of this condition.
	String(mapping variable.Map[S]) string
}

Condition describes a logical condition which can be used as branch conditions (e.g. for if/while, etc).

type Const

type Const[S symbol.Symbol[S]] struct {
	// contains filtered or unexported fields
}

Const represents a constant value within an expresion.

func (*Const[S]) Base

func (p *Const[S]) Base() uint

Base returns the based representation for this constant

func (*Const[S]) Constant

func (p *Const[S]) Constant() *big.Int

Constant returns the constant value this represents

func (*Const[S]) ExternUses

func (p *Const[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Const[S]) LocalUses

func (p *Const[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Const[S]) SetType

func (p *Const[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Const[S]) String

func (p *Const[S]) String(mapping variable.Map[S]) string

func (*Const[S]) Type

func (p *Const[S]) Type() data.Type[S]

Type implementation for Expr interface

type Div

type Div[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

Div represents an expression which computes the quotient of two terms.

func (*Div[S]) ExternUses

func (p *Div[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Div[S]) LocalUses

func (p *Div[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Div[S]) SetType

func (p *Div[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Div[S]) String

func (p *Div[S]) String(mapping variable.Map[S]) string

func (*Div[S]) Type

func (p *Div[S]) Type() data.Type[S]

Type implementation for Expr interface

type Expr

type Expr[S symbol.Symbol[S]] interface {
	// ExternUses returns the set of non-local declarations accessed by this
	// expression.  For example, external constants or memories used within.
	ExternUses() set.AnySortedSet[S]
	// LocalUses returns the set of variables used (i.e. read) by this expression
	LocalUses() bit.Set
	// String returns a string representation of this expression.
	String(mapping variable.Map[S]) string
	// Type returns the type associated with this expression (or nil if that has
	// not yet been determined).
	Type() data.Type[S]
	// SetType sets the type associated with this expression.
	SetType(data.Type[S])
}

Expr represents an arbitrary expression used within an instruction.

func NewAdd

func NewAdd[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewAdd constructs an expression representing the sum of one or more values.

func NewArrayAccess

func NewArrayAccess[S symbol.Symbol[S]](id variable.Id, arg Expr[S]) Expr[S]

NewArrayAccess constructs an expression representing an array access.

func NewBitwiseAnd

func NewBitwiseAnd[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewBitwiseAnd constructs an expression representing the bitwise-and of one or more values.

func NewBitwiseNot

func NewBitwiseNot[S symbol.Symbol[S]](e Expr[S]) Expr[S]

NewBitwiseNot constructs an expression representing the bitwise complement of a value.

func NewBitwiseOr

func NewBitwiseOr[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewBitwiseOr constructs an expression representing the bitwise-or of one or more values.

func NewCast

func NewCast[S symbol.Symbol[S]](e Expr[S], castType data.Type[S]) Expr[S]

NewCast constructs a cast expression.

func NewConcat

func NewConcat[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewConcat constructs an expression representing the bitwise concatenation of one (or more) expressions.

func NewDiv

func NewDiv[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewDiv constructs an expression representing the division of one or more values.

func NewExternAccess

func NewExternAccess[S symbol.Symbol[S]](name S, args ...Expr[S]) Expr[S]

NewExternAccess constructs an expression representing a non-local access, such as for a named constant or memory.

func NewLocalAccess

func NewLocalAccess[S symbol.Symbol[S]](variable variable.Id) Expr[S]

NewLocalAccess constructs an expression representing a register access.

func NewLogicalAnd

func NewLogicalAnd[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewLogicalAnd constructs an expression representing the bitwise-or of one or more values.

func NewLogicalNot

func NewLogicalNot[S symbol.Symbol[S]](e Expr[S]) Expr[S]

NewLogicalNot constructs an expression representing the bitwise complement of a value.

func NewLogicalOr

func NewLogicalOr[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewLogicalOr constructs an expression representing the bitwise-or of one or more values.

func NewMul

func NewMul[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewMul constructs an expression representing the product of one or more values.

func NewRem

func NewRem[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewRem constructs an expression representing the remainder of one or more values.

func NewShl

func NewShl[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewShl constructs an expression representing a left-shift.

func NewShr

func NewShr[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewShr constructs an expression representing a right-shift.

func NewSub

func NewSub[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewSub constructs an expression representing the subtraction of one or more values.

func NewTernary

func NewTernary[S symbol.Symbol[S]](cond, ifTrue, ifFalse Expr[S]) Expr[S]

NewTernary creates a new Ternary expression.

func NewTupleInitialiser

func NewTupleInitialiser[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewTupleInitialiser constructs a tuple initialiser expression.

func NewTypedConstant

func NewTypedConstant[S symbol.Symbol[S]](constant big.Int, base uint, bitwidth uint) Expr[S]

NewTypedConstant constructs an expression representing a constant value with a given bitwidth, along with a base (which is used for pretty printing, etc). This can be used to construct a constant expression after typing has been performed (i.e. because it includes an appropriate type)

func NewUntypedConstant

func NewUntypedConstant[S symbol.Symbol[S]](constant big.Int, base uint) Expr[S]

NewUntypedConstant constructs an expression representing a constant value, along with a base (which is used for pretty printing, etc). This can be used to construct a constant expression prior to typing, but should not be used to construct an expression after typing has been performed.

func NewXor

func NewXor[S symbol.Symbol[S]](exprs ...Expr[S]) Expr[S]

NewXor constructs an expression representing the bitwise-xor of one or more values.

type ExternAccess

type ExternAccess[S symbol.Symbol[S]] struct {
	Name S
	Args []Expr[S]
	// contains filtered or unexported fields
}

ExternAccess represents a reference to an external declaration, such as a named constant or memory.

func (*ExternAccess[S]) ExternUses

func (p *ExternAccess[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*ExternAccess[S]) LocalUses

func (p *ExternAccess[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*ExternAccess[S]) SetType

func (p *ExternAccess[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*ExternAccess[S]) String

func (p *ExternAccess[S]) String(mapping variable.Map[S]) string

func (*ExternAccess[S]) Type

func (p *ExternAccess[S]) Type() data.Type[S]

Type implementation for Expr interface

type LocalAccess

type LocalAccess[S symbol.Symbol[S]] struct {
	Variable variable.Id
	// contains filtered or unexported fields
}

LocalAccess represents a register access within an expression.

func (*LocalAccess[S]) ExternUses

func (p *LocalAccess[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*LocalAccess[S]) LocalUses

func (p *LocalAccess[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*LocalAccess[S]) SetType

func (p *LocalAccess[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*LocalAccess[S]) String

func (p *LocalAccess[S]) String(mapping variable.Map[S]) string

func (*LocalAccess[S]) Type

func (p *LocalAccess[S]) Type() data.Type[S]

Type implementation for Expr interface

type LogicalAnd

type LogicalAnd[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
}

LogicalAnd represents a bitwise-or of one or more terms.

func (*LogicalAnd[S]) ExternUses

func (p *LogicalAnd[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*LogicalAnd[S]) LocalUses

func (p *LogicalAnd[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*LogicalAnd[S]) SetType

func (p *LogicalAnd[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*LogicalAnd[S]) String

func (p *LogicalAnd[S]) String(mapping variable.Map[S]) string

func (*LogicalAnd[S]) Type

func (p *LogicalAnd[S]) Type() data.Type[S]

Type implementation for Expr interface

type LogicalNot

type LogicalNot[S symbol.Symbol[S]] struct {
	Expr Expr[S]
}

LogicalNot represents a bitwise-not (complement) of a single expression.

func (*LogicalNot[S]) ExternUses

func (p *LogicalNot[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*LogicalNot[S]) LocalUses

func (p *LogicalNot[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*LogicalNot[S]) SetType

func (p *LogicalNot[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*LogicalNot[S]) String

func (p *LogicalNot[S]) String(mapping variable.Map[S]) string

func (*LogicalNot[S]) Type

func (p *LogicalNot[S]) Type() data.Type[S]

Type implementation for Expr interface

type LogicalOr

type LogicalOr[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
}

LogicalOr represents a bitwise-or of one or more terms.

func (*LogicalOr[S]) ExternUses

func (p *LogicalOr[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*LogicalOr[S]) LocalUses

func (p *LogicalOr[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*LogicalOr[S]) SetType

func (p *LogicalOr[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*LogicalOr[S]) String

func (p *LogicalOr[S]) String(mapping variable.Map[S]) string

func (*LogicalOr[S]) Type

func (p *LogicalOr[S]) Type() data.Type[S]

Type implementation for Expr interface

type Mul

type Mul[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

Mul represents an expression which computes the product of one or more terms.

func (*Mul[S]) ExternUses

func (p *Mul[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Mul[S]) LocalUses

func (p *Mul[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Mul[S]) SetType

func (p *Mul[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Mul[S]) String

func (p *Mul[S]) String(mapping variable.Map[S]) string

func (*Mul[S]) Type

func (p *Mul[S]) Type() data.Type[S]

Type implementation for Expr interface

type Rem

type Rem[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

Rem represents an expression which computes the remainder of two terms.

func (*Rem[S]) ExternUses

func (p *Rem[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Rem[S]) LocalUses

func (p *Rem[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Rem[S]) SetType

func (p *Rem[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Rem[S]) String

func (p *Rem[S]) String(mapping variable.Map[S]) string

func (*Rem[S]) Type

func (p *Rem[S]) Type() data.Type[S]

Type implementation for Expr interface

type Resolved

type Resolved = Expr[symbol.Resolved]

Resolved represents an expression whose external identifiers are otherwise resolved. As such, it should not be possible that such a declaration refers to unknown (or otherwise incorrect) external components.

type ResolvedCondition

type ResolvedCondition = Condition[symbol.Resolved]

ResolvedCondition represents a condition whose external identifiers are otherwise resolved. As such, it should not be possible that such a declaration refers to unknown (or otherwise incorrect) external components.

type Shl

type Shl[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

Shl represents a left-shift of one value by another.

func (*Shl[S]) ExternUses

func (p *Shl[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Shl[S]) LocalUses

func (p *Shl[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Shl[S]) SetType

func (p *Shl[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Shl[S]) String

func (p *Shl[S]) String(mapping variable.Map[S]) string

func (*Shl[S]) Type

func (p *Shl[S]) Type() data.Type[S]

Type implementation for Expr interface

type Shr

type Shr[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

Shr represents a right-shift of one value by another.

func (*Shr[S]) ExternUses

func (p *Shr[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Shr[S]) LocalUses

func (p *Shr[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Shr[S]) SetType

func (p *Shr[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Shr[S]) String

func (p *Shr[S]) String(mapping variable.Map[S]) string

func (*Shr[S]) Type

func (p *Shr[S]) Type() data.Type[S]

Type implementation for Expr interface

type Sub

type Sub[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

Sub represents an expression which subtracts zero or more terms from a given term.

func (*Sub[S]) ExternUses

func (p *Sub[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Sub[S]) LocalUses

func (p *Sub[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Sub[S]) SetType

func (p *Sub[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Sub[S]) String

func (p *Sub[S]) String(mapping variable.Map[S]) string

func (*Sub[S]) Type

func (p *Sub[S]) Type() data.Type[S]

Type implementation for Expr interface

type Ternary

type Ternary[S symbol.Symbol[S]] struct {
	Cond    Expr[S]
	IfTrue  Expr[S]
	IfFalse Expr[S]
	// contains filtered or unexported fields
}

Ternary represents a conditional expression: condition ? ifTrue : ifFalse

func (*Ternary[S]) ExternUses

func (p *Ternary[S]) ExternUses() set.AnySortedSet[S]

ExternUses returns the set of external variables used by the expression.

func (*Ternary[S]) LocalUses

func (p *Ternary[S]) LocalUses() bit.Set

LocalUses returns the set of local variables used by the expression.

func (*Ternary[S]) SetType

func (p *Ternary[S]) SetType(t data.Type[S])

SetType sets the data type of the expression, which is determined during type checking.

func (*Ternary[S]) String

func (p *Ternary[S]) String(mapping variable.Map[S]) string

func (*Ternary[S]) Type

func (p *Ternary[S]) Type() data.Type[S]

Type returns the data type of the expression, which is determined during type checking.

type TupleInitialiser

type TupleInitialiser[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

TupleInitialiser represents an intialiser from one or more expressions.

func (*TupleInitialiser[S]) ExternUses

func (p *TupleInitialiser[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*TupleInitialiser[S]) LocalUses

func (p *TupleInitialiser[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*TupleInitialiser[S]) SetType

func (p *TupleInitialiser[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*TupleInitialiser[S]) String

func (p *TupleInitialiser[S]) String(mapping variable.Map[S]) string

func (*TupleInitialiser[S]) Type

func (p *TupleInitialiser[S]) Type() data.Type[S]

Type implementation for Expr interface

type Unresolved

type Unresolved = Expr[symbol.Unresolved]

Unresolved represents an expression whose identifiers for external components are unresolved linkage records. As such, its possible that such an expression instruction may fail with an error at link time due to an unresolvable reference to an external component (e.g. function, RAM, ROM, etc).

type UnresolvedCondition

type UnresolvedCondition = Condition[symbol.Unresolved]

UnresolvedCondition represents a condition whose identifiers for external components are unresolved linkage records. As such, its possible that such an expression instruction may fail with an error at link time due to an unresolvable reference to an external component (e.g. function, RAM, ROM, etc).

type Xor

type Xor[S symbol.Symbol[S]] struct {
	Exprs []Expr[S]
	// contains filtered or unexported fields
}

Xor represents a bitwise-xor of one or more terms.

func (*Xor[S]) ExternUses

func (p *Xor[S]) ExternUses() set.AnySortedSet[S]

ExternUses implementation for the Expr interface.

func (*Xor[S]) LocalUses

func (p *Xor[S]) LocalUses() bit.Set

LocalUses implementation for the Expr interface.

func (*Xor[S]) SetType

func (p *Xor[S]) SetType(t data.Type[S])

SetType implementation for Expr interface

func (*Xor[S]) String

func (p *Xor[S]) String(mapping variable.Map[S]) string

func (*Xor[S]) Type

func (p *Xor[S]) Type() data.Type[S]

Type implementation for Expr interface

Jump to

Keyboard shortcuts

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