MCSBL - Mathematical Concatenative Stack Based Language

MCSBL - is powerful, simple, stack-based programming language created for mathematical calculations
Interpreter of MCSBL is writed on ruby.
MCSBL - is new idea, it's mix of concatenative, stack-oriented and functional programming languages paradigms.
It's created for the purposes of this strict - math and math calculation automation, it features enough to handle strings, but a lot of mathematical calculations. You need know it's, before using MCSBL.
MCSBL using postfix syntax.
Is MCSBL version 1.0 and newer available integration into ruby. E.x.:

# Example REPL based on MCSBL interpreter writed on ruby

# Load MCSBL interpreter class
load "MCSBL.CLASS.rb"

# Logo:3
logo

# Repl
def repl
print "\n>> "
i = STDIN.gets.chomp rescue exit
MCSBL.new(i).run
repl
end

# Run inputed MCSBL code
repl
MCSBL is licensed under WTFPL

Examples

Hello, world!

"Hello, world!" println

Fibonacci number

5 fib println

Factorial calculator

; Factorial calculator

; Input data and convert it's to integer
accept to_i

; calculate
dup fact

; Output
println

Function declaration example

; Declare function
:square dup *

accept to_i @square println

Greatest common divisor calculator

; Input a
"a=" print
accept to_i cr ; cr - print linefeed
; Input b
"b=" print
accept to_i

; Output
gcd println

Least common multiple calculator

; Input a
"a=" print
accept to_i cr ; cr - print linefeed
; Input b
"b=" print
accept to_i

; Output
lcm println

Tests is input number is prime

"Input number: " print
accept to_i isprime if 
	"Is prime" println
else
    "Is not prime" println
end_if

Counts to inputed number

0 "i" def
"Enter number: " print
accept to_i "in" def
cr
"start" label
"i" get to_i "in" get to_i equal not if
	"i" inc
	"i" get println
	"start" goto
end_if

Convert passed number to binary

"2bin: " print
accept to_i "input" def
2 "input" get to_bi println

Generate random number

"Random number from 5 to 10: " print 10 5 randr print cr
"Random number from 0 to 10: " print 10 randn print cr
"Random number: " print rand print cr

MCSBL repl

; it's MCSBL repl writed on MCSBL:\

"MCSBL (c) 2016 Zonald Haider  " println
"Web: absurdlangscollection.comuf.com/MCSBL" println
"repl" label
cr ">> " print
accept to_s "i" def

"i" get eval
"repl" goto

Downloads

Download MCSBL interpreter. Warning: you need install ruby before.
Last update: 13.11.2016

Build 1.1
Size: 3 789 bytes
Date: 13.11.2016
Changelog:
- Added function readf, reads file
- Added function writef, writes data to file
- Added function deletef, deletes file
- Added function linesf, returns count of lines in file
- Added function load, includes other code file
Download

Build 1.0fix
Size: 3 694 bytes
Date: 12.11.2016
Changelog:
- Critical error fix!
Download

Build 1.0
Size: 3 642 bytes
Date: 12.11.2016
Changelog:
- Repl added
- Ruby integration available
- Totaly system rebuilded
- Added function isodd, tests is number is odd
- Added function iseven, tests is number is even
Download

Build 0.9
Size: 3 365 bytes
Date: 11.11.2016
Changelog:
- Added function to_bi, changes base of integer
- Added function s_to_lower, changes case of string to lower
- Added function s_to_upper, changes case of string to upper
- Added function getchr, gets char at position
- Added function reverse, reverses string
- Added function scan, returns counts of substrings in passed string
Download

Build 0.8
Size: 3 292 bytes
Date: 08.11.2016
Changelog:
- Added function round, rounds float to integer
- Added math function next, e.x.: "5 next print" will return 6
- Added math function lcm
- Added byte operands: |, << and >>
- Added operand to_f, converts number to float
- Added operand to_r, converts number to number fraction
Download

Build 0.7
Size: 3 217 bytes
Date: 05.11.2016
Changelog:
- Added function randn, generates random number with passed range
- Added function randr, generates random number from passed max to min
- Added function isprime, tests is prime number or not
Download

Build 0.6
Size: 3 112 bytes
Date: 02.11.2016
Changelog:
- Fix error in function gcd
Download

Build 0.5
Size: 3 111 bytes
Date: 27.10.2016
Changelog:
- Added license file
- Error system update
- Added logo
Download

Build 0.4
Size: 2 500 bytes
Date: 26.10.2016
Changelog:
- Critical error fix!
Download

Build 0.3
Size: 2 508 bytes
Date: 20.10.2016
Changelog:
- Added fib math function
Download

Build 0.2
Size: 2 464 bytes
Date: 15.10.2016
Changelog:
- Added abs math function
- Added lesseq and greatereq conditional operands
Download

Build 0.1
Size: 2 441 bytes
Date: 5.01.2016
Changelog:
- It's first release.
Download