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
Index ¶
Constants ¶
const ADD uint = 16
ADD represents integer addition
const AND uint = 15
AND represents logical conjunction
const BOTTOM uint = 12
BOTTOM represents logical falsehood
const END_OF uint = 0
END_OF signals "end of file"
const EQUALS uint = 6
EQUALS signals an equality
const GREATERTHAN uint = 10
GREATERTHAN signals a (strict) inequality X > Y
const GREATERTHAN_EQUALS uint = 11
GREATERTHAN_EQUALS signals a (non-strict) inequality X >= Y
const IDENTIFIER uint = 5
IDENTIFIER signals a column variable.
const LBRACE uint = 2
LBRACE signals "left brace"
const LESSTHAN uint = 8
LESSTHAN signals a (strict) inequality X < Y
const LESSTHAN_EQUALS uint = 9
LESSTHAN_EQUALS signals a (non-strict) inequality X <= Y
const MUL uint = 18
MUL represents integer multiplication
const NOT_EQUALS uint = 7
NOT_EQUALS signals a non-equality
const NUMBER uint = 4
NUMBER signals an integer number
const OR uint = 14
OR represents logical disjunction
const RBRACE uint = 3
RBRACE signals "right brace"
const SUB uint = 17
SUB represents integer subtraction
const TOP uint = 13
TOP represents logical truth
const WHITESPACE uint = 1
WHITESPACE signals whitespace
Variables ¶
var BINOPS = []uint{SUB, MUL, ADD}
BINOPS captures the set of binary operations
var CONDITIONS = []uint{EQUALS, NOT_EQUALS, LESSTHAN, LESSTHAN_EQUALS, GREATERTHAN, GREATERTHAN_EQUALS}
CONDITIONS captures the set of conditions.
var CONNECTIVES = []uint{AND, OR}
CONNECTIVES captures the set of logical connectives.
Functions ¶
Types ¶
type Parser ¶
type Parser[T Term[T]] struct { // contains filtered or unexported fields }
Parser provides a general-purpose parser for propositions and arithmetic expressions.
type Term ¶
type Term[T any] interface { // Create new variable. Variable(string) T // Create new constant. Number(big.Int) T // Logical Or(...T) T And(...T) T Truth(bool) T // Relational Equals(T) T NotEquals(T) T LessThan(T) T LessThanEquals(T) T // Arithmetic Add(...T) T Mul(...T) T Sub(...T) T }
Term represents an abstraction over boolean expressions.