Versions in this module Expand all Collapse all v0 v0.1.0 Jan 6, 2025 Changes in this version + const Break + const Continue + var Const = map[string]float64 + var ErrAlreadyDeclared = errors.New("already declared") + var ErrClassicalBitNotFound = errors.New("classical bit not found") + var ErrFunctionNotFound = errors.New("function not found") + var ErrGateNotFound = errors.New("gate not found") + var ErrIdentifierNotFound = errors.New("identifier not found") + var ErrNotImplemented = errors.New("not implemented") + var ErrQubitNotFound = errors.New("qubit not found") + var ErrUnexpected = errors.New("unexpected") + var ErrVariableNotFound = errors.New("variable not found") + type Environ struct + ClassicalBit map[string][]int64 + Const map[string]interface{} + Gate map[string]Gate + Outer *Environ + Qubit map[string][]q.Qubit + Subroutine map[string]Subroutine + Variable map[string]interface{} + Version string + func NewEnviron() *Environ + func (e *Environ) GetClassicalBit(name string) ([]int64, bool) + func (e *Environ) GetConst(name string) (interface{}, bool) + func (e *Environ) GetGate(name string) (Gate, bool) + func (e *Environ) GetQubit(name string) ([]q.Qubit, bool) + func (e *Environ) GetSubroutine(name string) (Subroutine, bool) + func (e *Environ) GetVariable(name string) (interface{}, bool) + func (e *Environ) NewEnclosed() *Environ + func (e *Environ) SetVariable(name string, value interface{}) + type Gate struct + Body []*parser.GateCallStatementContext + Name string + Params []string + QArgs []string + type Subroutine struct + Body *parser.ScopeContext + Name string + QArgs []string + ReturnSignature *parser.ReturnSignatureContext + type Visitor struct + Environ *Environ + func New(qsim *q.Q, env *Environ) *Visitor + func (v *Visitor) Builtin(ctx *parser.GateCallStatementContext) (matrix.Matrix, bool, error) + func (v *Visitor) Defined(ctx *parser.GateCallStatementContext) (matrix.Matrix, error) + func (v *Visitor) Enclosed() *Visitor + func (v *Visitor) MeasureAssignment(identifier parser.IIndexedIdentifierContext, ...) error + func (v *Visitor) Modify(u matrix.Matrix, qargs []q.Qubit, modifier []parser.IGateModifierContext) (matrix.Matrix, error) + func (v *Visitor) Params(xlist parser.IExpressionListContext) ([]float64, error) + func (v *Visitor) Visit(tree antlr.ParseTree) interface{} + func (v *Visitor) VisitAdditiveExpression(ctx *parser.AdditiveExpressionContext) interface{} + func (v *Visitor) VisitAliasDeclarationStatement(ctx *parser.AliasDeclarationStatementContext) interface{} + func (v *Visitor) VisitAliasExpression(ctx *parser.AliasExpressionContext) interface{} + func (v *Visitor) VisitAnnotation(ctx *parser.AnnotationContext) interface{} + func (v *Visitor) VisitArgumentDefinition(ctx *parser.ArgumentDefinitionContext) interface{} + func (v *Visitor) VisitArgumentDefinitionList(ctx *parser.ArgumentDefinitionListContext) interface{} + func (v *Visitor) VisitArrayLiteral(ctx *parser.ArrayLiteralContext) interface{} + func (v *Visitor) VisitArrayReferenceType(ctx *parser.ArrayReferenceTypeContext) interface{} + func (v *Visitor) VisitArrayType(ctx *parser.ArrayTypeContext) interface{} + func (v *Visitor) VisitAssignmentStatement(ctx *parser.AssignmentStatementContext) interface{} + func (v *Visitor) VisitBarrierStatement(ctx *parser.BarrierStatementContext) interface{} + func (v *Visitor) VisitBitshiftExpression(ctx *parser.BitshiftExpressionContext) interface{} + func (v *Visitor) VisitBitwiseAndExpression(ctx *parser.BitwiseAndExpressionContext) interface{} + func (v *Visitor) VisitBitwiseOrExpression(ctx *parser.BitwiseOrExpressionContext) interface{} + func (v *Visitor) VisitBitwiseXorExpression(ctx *parser.BitwiseXorExpressionContext) interface{} + func (v *Visitor) VisitBoxStatement(ctx *parser.BoxStatementContext) interface{} + func (v *Visitor) VisitBreakStatement(ctx *parser.BreakStatementContext) interface{} + func (v *Visitor) VisitCalStatement(ctx *parser.CalStatementContext) interface{} + func (v *Visitor) VisitCalibrationGrammarStatement(ctx *parser.CalibrationGrammarStatementContext) interface{} + func (v *Visitor) VisitCallExpression(ctx *parser.CallExpressionContext) interface{} + func (v *Visitor) VisitCastExpression(ctx *parser.CastExpressionContext) interface{} + func (v *Visitor) VisitChildren(node antlr.RuleNode) interface{} + func (v *Visitor) VisitClassicalDeclarationStatement(ctx *parser.ClassicalDeclarationStatementContext) interface{} + func (v *Visitor) VisitComparisonExpression(ctx *parser.ComparisonExpressionContext) interface{} + func (v *Visitor) VisitConstDeclarationStatement(ctx *parser.ConstDeclarationStatementContext) interface{} + func (v *Visitor) VisitContinueStatement(ctx *parser.ContinueStatementContext) interface{} + func (v *Visitor) VisitDeclarationExpression(ctx *parser.DeclarationExpressionContext) interface{} + func (v *Visitor) VisitDefStatement(ctx *parser.DefStatementContext) interface{} + func (v *Visitor) VisitDefcalArgumentDefinition(ctx *parser.DefcalArgumentDefinitionContext) interface{} + func (v *Visitor) VisitDefcalArgumentDefinitionList(ctx *parser.DefcalArgumentDefinitionListContext) interface{} + func (v *Visitor) VisitDefcalOperand(ctx *parser.DefcalOperandContext) interface{} + func (v *Visitor) VisitDefcalOperandList(ctx *parser.DefcalOperandListContext) interface{} + func (v *Visitor) VisitDefcalStatement(ctx *parser.DefcalStatementContext) interface{} + func (v *Visitor) VisitDefcalTarget(ctx *parser.DefcalTargetContext) interface{} + func (v *Visitor) VisitDelayStatement(ctx *parser.DelayStatementContext) interface{} + func (v *Visitor) VisitDesignator(ctx *parser.DesignatorContext) interface{} + func (v *Visitor) VisitDurationofExpression(ctx *parser.DurationofExpressionContext) interface{} + func (v *Visitor) VisitEndStatement(ctx *parser.EndStatementContext) interface{} + func (v *Visitor) VisitEqualityExpression(ctx *parser.EqualityExpressionContext) interface{} + func (v *Visitor) VisitErrorNode(node antlr.ErrorNode) interface{} + func (v *Visitor) VisitExpressionList(ctx *parser.ExpressionListContext) interface{} + func (v *Visitor) VisitExpressionStatement(ctx *parser.ExpressionStatementContext) interface{} + func (v *Visitor) VisitExternArgument(ctx *parser.ExternArgumentContext) interface{} + func (v *Visitor) VisitExternArgumentList(ctx *parser.ExternArgumentListContext) interface{} + func (v *Visitor) VisitExternStatement(ctx *parser.ExternStatementContext) interface{} + func (v *Visitor) VisitForStatement(ctx *parser.ForStatementContext) interface{} + func (v *Visitor) VisitGateCallStatement(ctx *parser.GateCallStatementContext) interface{} + func (v *Visitor) VisitGateModifier(ctx *parser.GateModifierContext) interface{} + func (v *Visitor) VisitGateOperand(ctx *parser.GateOperandContext) interface{} + func (v *Visitor) VisitGateOperandList(ctx *parser.GateOperandListContext) interface{} + func (v *Visitor) VisitGateStatement(ctx *parser.GateStatementContext) interface{} + func (v *Visitor) VisitIdentifierList(ctx *parser.IdentifierListContext) interface{} + func (v *Visitor) VisitIfStatement(ctx *parser.IfStatementContext) interface{} + func (v *Visitor) VisitIncludeStatement(ctx *parser.IncludeStatementContext) interface{} + func (v *Visitor) VisitIndexExpression(ctx *parser.IndexExpressionContext) interface{} + func (v *Visitor) VisitIndexOperator(ctx *parser.IndexOperatorContext) interface{} + func (v *Visitor) VisitIndexedIdentifier(ctx *parser.IndexedIdentifierContext) interface{} + func (v *Visitor) VisitIoDeclarationStatement(ctx *parser.IoDeclarationStatementContext) interface{} + func (v *Visitor) VisitLiteralExpression(ctx *parser.LiteralExpressionContext) interface{} + func (v *Visitor) VisitLogicalAndExpression(ctx *parser.LogicalAndExpressionContext) interface{} + func (v *Visitor) VisitLogicalOrExpression(ctx *parser.LogicalOrExpressionContext) interface{} + func (v *Visitor) VisitMeasureArrowAssignmentStatement(ctx *parser.MeasureArrowAssignmentStatementContext) interface{} + func (v *Visitor) VisitMeasureExpression(ctx *parser.MeasureExpressionContext) interface{} + func (v *Visitor) VisitMultiplicativeExpression(ctx *parser.MultiplicativeExpressionContext) interface{} + func (v *Visitor) VisitOldStyleDeclarationStatement(ctx *parser.OldStyleDeclarationStatementContext) interface{} + func (v *Visitor) VisitParenthesisExpression(ctx *parser.ParenthesisExpressionContext) interface{} + func (v *Visitor) VisitPowerExpression(ctx *parser.PowerExpressionContext) interface{} + func (v *Visitor) VisitPragma(ctx *parser.PragmaContext) interface{} + func (v *Visitor) VisitProgram(ctx *parser.ProgramContext) interface{} + func (v *Visitor) VisitQuantumDeclarationStatement(ctx *parser.QuantumDeclarationStatementContext) interface{} + func (v *Visitor) VisitQubitType(ctx *parser.QubitTypeContext) interface{} + func (v *Visitor) VisitRangeExpression(ctx *parser.RangeExpressionContext) interface{} + func (v *Visitor) VisitResetStatement(ctx *parser.ResetStatementContext) interface{} + func (v *Visitor) VisitReturnSignature(ctx *parser.ReturnSignatureContext) interface{} + func (v *Visitor) VisitReturnStatement(ctx *parser.ReturnStatementContext) interface{} + func (v *Visitor) VisitScalarType(ctx *parser.ScalarTypeContext) interface{} + func (v *Visitor) VisitScope(ctx *parser.ScopeContext) interface{} + func (v *Visitor) VisitSetExpression(ctx *parser.SetExpressionContext) interface{} + func (v *Visitor) VisitStatement(ctx *parser.StatementContext) interface{} + func (v *Visitor) VisitStatementOrScope(ctx *parser.StatementOrScopeContext) interface{} + func (v *Visitor) VisitSwitchCaseItem(ctx *parser.SwitchCaseItemContext) interface{} + func (v *Visitor) VisitSwitchStatement(ctx *parser.SwitchStatementContext) interface{} + func (v *Visitor) VisitTerminal(node antlr.TerminalNode) interface{} + func (v *Visitor) VisitUnaryExpression(ctx *parser.UnaryExpressionContext) interface{} + func (v *Visitor) VisitVersion(ctx *parser.VersionContext) interface{} + func (v *Visitor) VisitWhileStatement(ctx *parser.WhileStatementContext) interface{}