numscript

package module
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 3 Imported by: 0

README

Numscript CLI

GitHub Release Go Reference Go codecov

Numscript is the DSL used to express financial transaction within the Formance ledger. You can try it in its online playground

The CLI in this repo allows you to play with numscript locally, check if there are parsing or logic errors in your numscript files, and run the numscript language server

The language server features include:

  • Diagnostics
  • Hover on values
  • Detect document symbols
  • Go to definition
Installation

You can install the numscript cli with one of the following ways:

Using curl

curl -sSf https://raw.githubusercontent.com/formancehq/numscript/main/install.sh | bash

Using golang toolchain

go install github.com/formancehq/numscript/cmd/numscript@latest
Telemetry

Release builds of the numscript CLI send anonymous crash reports to Sentry when the program panics. A crash report contains the panic message, a stack trace, and the CLI version — nothing else. No reports are sent during normal operation, and development builds (built from source with go install or go build, where the version is develop) never send anything.

To disable crash reporting entirely, set the NUMSCRIPT_NO_TELEMETRY environment variable to any non-empty value:

export NUMSCRIPT_NO_TELEMETRY=1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrScalingNotSupported = interpreter.ErrScalingNotSupported
View Source
var ParseErrorsToString = parser.ParseErrorsToString

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance = interpreter.AccountBalance

type AccountDependency added in v0.0.25

type AccountDependency = interpreter.AccountDependency

type AccountMetadataRow added in v0.0.25

type AccountMetadataRow = interpreter.AccountMetadataRow

Input account metadata (opaque, string-valued) read via meta()

type AccountsMetadata

type AccountsMetadata = interpreter.AccountsMetadata

type BalanceQuery

type BalanceQuery = interpreter.BalanceQuery

For each account, list of the needed assets

type BalanceQueryItem added in v0.0.25

type BalanceQueryItem = interpreter.BalanceQueryItem

type BalanceRow added in v0.0.25

type BalanceRow = interpreter.BalanceRow

type Balances

type Balances = interpreter.Balances

type ExecutionResult

type ExecutionResult = interpreter.ExecutionResult

type InterpreterError

type InterpreterError = interpreter.InterpreterError

type MetaDependency added in v0.0.25

type MetaDependency = interpreter.MetaDependency

type Metadata

type Metadata = interpreter.Metadata

The transaction metadata, set by set_tx_meta()

type MetadataQuery

type MetadataQuery = interpreter.MetadataQuery

type MissingFundsErr

type MissingFundsErr = interpreter.MissingFundsErr

type ParseResult

type ParseResult struct {
	// contains filtered or unexported fields
}

This struct represents a parsed numscript source code

func Parse

func Parse(code string) ParseResult

func (ParseResult) GetNeededVariables

func (p ParseResult) GetNeededVariables() map[string]string

Returns a map from a variable's name to its type.

doesn't include variables whose value is already defined within the script

func (ParseResult) GetParsingErrors

func (p ParseResult) GetParsingErrors() []ParserError

func (ParseResult) GetSource

func (p ParseResult) GetSource() string

func (ParseResult) ResolveDependencies added in v0.0.25

func (p ParseResult) ResolveDependencies(ctx context.Context, vars VariablesMap, store Store) (ResolvedDependencies, error)

ResolveDependencies statically determines which accounts and metadata the script reads and writes, resolving account/asset/key expressions against the given vars and store.

func (ParseResult) Run

func (ParseResult) RunWithFeatureFlags

func (p ParseResult) RunWithFeatureFlags(
	ctx context.Context,
	vars VariablesMap,
	store Store,
	featureFlags map[string]struct{},
) (ExecutionResult, InterpreterError)

type ParserError

type ParserError = parser.ParserError

type Posting

type Posting = interpreter.Posting

type ResolvedDependencies added in v0.0.25

type ResolvedDependencies = interpreter.ResolvedDependencies

type SetAccountMetadataRow added in v0.0.25

type SetAccountMetadataRow = interpreter.SetAccountMetadataRow

The account metadata set during the execution (tagged, typed values)

type SetAccountsMetadata added in v0.0.25

type SetAccountsMetadata = interpreter.SetAccountsMetadata

type StaticStore

type StaticStore = interpreter.StaticStore

type Store

type Store = interpreter.Store

type Value

type Value = interpreter.Value

type VariablesMap

type VariablesMap = interpreter.VariablesMap

Directories

Path Synopsis
Builder to format numscript document
Builder to format numscript document
cmd
numscript command
internal
cmd
lsp

Jump to

Keyboard shortcuts

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