2025-09-12 16:38:16 -04:00
2025-09-12 16:38:16 -04:00
2025-05-10 10:43:36 -04:00
2024-12-14 20:35:36 -05:00
2024-11-09 04:37:56 -05:00
2024-12-28 09:30:35 -05:00
2025-04-26 10:58:09 -04:00
2025-08-23 10:53:12 -04:00
2025-08-27 12:30:28 -04:00
2025-08-29 09:56:40 -04:00
2025-09-12 16:38:16 -04:00

SCL: Simple CAS Language

Version v0.3

SCL aims to be a human-friendly Computer Algebra System (CAS) inspired by maxima that feels like writing on paper. In its current state, SCL can be used as a functional programming language capable of performing simple arithmetic. The codebase is about 2,000 lines of C, including a parser, interpreter, and runtime. It uses a linked environment scoping model.

Usage

To download and run:

git clone https://git.signorovitch.org/jacob/scl -b stable && cd scl
make release
./scl.out

For Development

git clone git@signorovitch.org:jacob/scl --recurse-submodules && cd scl
make all test
./scl.out

If you wish to run tests, make sure to run git clone --recurse-submodules to include the Unity test framework.

Syntax

As one would expect, you can evaluate simple infix expressions:

> 1 + 1
= 2

You can also define your own functions and variables:

> f(x) 2 * x
> n = 3
> f(n)
= 6

Being a functional programming language at heart, one can of course use lambda functions:

> (\(x) 2 * x)(5)
= 10
> f(g) g(2)
> f(\(x) 2 * x)
= 4

Here's a simple factorial function:

> factorial(n) {
>   if (n == 0) { 1 }
>   else { n * factorial(n - 1) }
> }

Or, using SCL's more concise syntax:

> factorial(n) ? n == 0 1 n * factorial(n - 1)
Description
Simple CAS Language.
c
Readme 730 KiB
Languages
C 80.8%
Yacc 10.2%
Makefile 5.6%
Shell 3.4%