Navigation
[Home] [Console] [Guide] [Applications] [Index] [Back]

Sxript Programming Language


Abstract
Sxript is an interpreted functional/procedural programming language designed for numerical evaluation and problem solving with high-order functions, variable storage, scoped subprograms, and arbitrary-precision numbers, along with file I/O, graphical output, and more. Sxript may be used as a stand-alone tool on most devices, or included as a component of any BASIC, JavaScript, or C++ application. All source code is written in a strict subset of the QB45 language, and is auto-translated by the BAS-TO-X utility into other languages.

Browser Instances

Console

Calculator

Download
sxript.zip

Contact
william (at) barnesreport.net

Legal
Sxript is conveyed as open source free software, as detailed in license.txt.

Logo
Signature of a Medieval Illiterate - Frederick W. Umminger Jr., Yale Record, 1959.


Guide
[Home] [Console] [Guide] [Applications] [Index] [Back]

Click to run Example Program
Example Program
Discussion
Links
`...All programs are actually subprograms...': Quotes and Numbers pass through as stable. Lines are separated by the semicolon ( : ). Quote , Number
include(`../test/arithmetic.txt'): Execute code stored on file, namely arithmetic.txt, to load variables and/or functions. Execute , arithmetic.txt
print_`Welcome!\n': Print a welcome message. Note the newline sequence \n before closing the quote. Print
let(rollone,dice(6)): Call the dice function to generate a random number from a 6-sided dice, and store the result in variable rollone. Function , Let
print_`Single roll: ' + quote([rollone]) + `\n': Print the stored result of single dice roll embedded in a quote. The variable reference is replaced by its literal value when enclosed in square brackets ( [ ] ). Variable Reference
func(rolltwo,{<dice([x]),dice([x])>}): Define a single-line function that rolls two [x]-sided dice and returns a vector. func , Vector
print_`Your double dice roll is: '
+ quote(rolltwo(6)) + `\n\n':
Whitespace and break returns only matter within quotes. Whitespace
func(rollmany,{ Define a function called rollmany. The body occurs as occulted code. Occult
  sub({ Multi-line functions are contained in a subprogram or codeblock. Subprogram / Codeblock
    let(a,[x]): Input arguments manifest as [x], [y], [z], etc. ...
    let(b,[y]): Variables and functions defined in a subprogram are destroyed as the subprogram closes. Codeblocks preserve variables. ...
    do: Elementary statements from imperative programming, namely if, goto, do/loop, etc. are available within any (and limited to the same) given subprogram or codeblock. if , goto , do/loop
    print_dice([a]),: The only output carried away by the subprogram or codeblock is what follows print. ...
    loop: Re-iterate loop if (internal) iteration count less than b. ...
  }) Close subprogram. ...
}): End definition of function rollmany. ...
print_rollmany(6,10) Call rollmany function to roll 6-sided dice 10 times and print the result. ...
Click to run Example Program



Applications
[Home] [Console] [Guide] [Applications] [Index] [Back]

(#)
24 Game
100 Doors
A
Analytic Functions
Arithmetic
B
Bitwise Operations
C
Calculus
Calendar Core
Callbacks
Coconut Pyramids
Combinator
Complex Functions
Complex Numbers
Conway's Game of Life
Currying
D
Dinesman Dwelling Problem
E
Epoch Clock
Epoch Clock (Reverse)
Example
F
Fern Fractal
Fibonacci Numbers
Fibonacci Shortcut
FizzBuzz
Flower by Turtle Graphics
G
Generalized Mutiplication
Golden Ratio
H
Hash Function
Hash Table
Haskell Imitation
High-Order Functions

I
Icons
J
K
Koch Fractals
L
Large Precision Numbers
Linear Algebra
List Memorization
M
Math Constants
Matrix Operations
N
Nonlinear System (2D by Inverse)
Nonlinear System (N=2D)
Nonlinear System (N=3D)
Nth
O
Objects
P
Pascal Triangle
Permutation of a String
Pi as Nested Radicals
Points on a Circle
Polynomial Regression
Q
R
Roots of a Function

S
Sierpinski Triangle
Sorting Algorithms
Square Root Table
Statistics
String Tools
Sxript Alpha
Symplectic Integrator
T
Time Core
Tree Traversal
U
V
Vector Tools
W
Water Collected Between Towers
X
Y
Z


Index
[Home] [Console] [Guide] [Applications] [Index] [Back]

(#) : $
A : alet , anchor , apply , asc , atan
B : block
C : chr , column , cos
D : do
E : elem , exe
F : for , func
G : goto , greater
H

I : if_@ , iff , include , instr , int
J
K
L : lambda , large(*/+-) , lcase , left , len , let , loop
M : map , mid
N : Number Type
O : Occult Type , Operators
P : print
Q : Quote Type
R : rand , reduce , replace , report , reset , right

S : sin , smooth , stack , sub
T : tan , tilde , type
U : ucase
V : Variable Reference , Vector Type
W : Whitespace
X
Y
Z