Masqualia

Masqualia is designed by PSTF.
= Language Overview =
Masqualia is based on Brainfuck, is extended version of Brainfuck. Masqualia supports conditional jumps, loops, arithmetics, I/O, has a tape, a stack, four accumulators, and can access the register.
Masqualia didn't uses traditional Brainfuck syntax, but Assembled syntax instead.
= Basic commands =
FWD
BKD
INC x
DEC x
WRT x
REA x
LOOP cond
END
# FWD moves pointer forward.
# BKD moves pointer backward.
# INC x increases x by 1. CURCELL is pointed cell, STACKTOP is stack top, AX BX CX DX AL BL CL DL AH BH CH DH CS IP DS DP SS SP RG01 RG02 RG03 are registers, STACK2ND is second stack top element.
# DEC x same as INC x, but decrease instead of increase.
# WRT x outputs x as character.
# REA x reads a character and push it into x.
# LOOP is [, and END is ]END can also used as function end, or subroutine end.. You can modify the condition by yourself, if blank it then the condition is CURCELL!=0.
= Slightly advanced commands =
OUT x
IN x
SAY x
LSN x
ADD x y
SUB x y
MUL x y
DIV x y
MOD x y
EXP x y
DCL x type val
SET x (type) (val)
OR x y
AND x y
XOR x y
NOT x
REV x
# OUT x outputs the value of x.
# IN x inputs a string to x. If x is CURCELL, then parse out the integer in decimal. If x is STACKTOP, then push the string reversely.
# SAY x output x as integer.
# LSN x inputs an integer and push it into x.
# ADD x y adds y to x.
# SUB x y subtracts y from x.
# MUL x y multiplies x by y.
# DIV x y divides x by y. If y is zero then raises "Divide by zero".
# MOD x y modulos x by y. If y is zero then raises "Divide by zero".
# EXP x y multiplies x by x over and over y times. If y is zero then return 1.
# DCL x type val declares a variable x with specified type and value.
# SET x type val assigns specified type or value to x.
# OR x y bitwise ors x by y.
# AND x y bitwise ands x by y.
# XOR x y bitwise xors x by y.
# NOT x bitwise nots x.
# REV x reverses x. If x is list or string then it is flipping, if x is boolean then it is logical not, and if x is integer or float then it is negation.
= Advanced Commands =
LOG x y
HXD
DCM
OCT
BIN
TER
BSF
NOP
PAUSE
EXT
BRK
CTN
BYE
# LOG x y Gets the y-base logarithmic number of x.
# HXD turns the I/O to hexadecimal.
# DCM turns the I/O to decimal.
# OCT turns the I/O to octal.
# BIN turns the I/O to binary.
# TER turns the I/O to ternary.
# BSF turns the I/O to base-64.
# NOP is a no operation.
# PAUSE pauses and print "Press any key to continue..." and then wait the user input.
# EXT exits the program.
# BRK breaks a loop.
# CTN breaks the current round of loop.
# BYE exits the programming environment.
= More Advanced Commands =
#INCLUDE library_name
DO function_name param_list code END
RUN function_name param_list END
OPEN x y
CLOSE x
READFRM x
WRITETO x
PUSH x
POP x
DUMP x y
SWAP x y
SORT list
RST x
WAIT x
# #INCLUDE library_name includes the library you specified.
# DO function_name param_list code END defines a function.
# RUN function_name param_list END runs a function.
# OPEN x y opens the file x, with the operation y("r" is read-only, "r+" is read-write, "w" is write-only, "a" is append, "a+" is read-append). If the operation y is read-only and x doesn't exist then raise "No such file or directory", otherwise if y is others and x doesn't exist then generates the file x.
# CLOSE x closes the file x.
# READFRM x directs input to x. If x is CON, then the input is directed to stdin.
# WRITETO x directs output to x. If x is CON, then the output is directed to stdout.
# PUSH x pushes x into the stack. If x is not specified, then duplicate the stack top.
# POP x pops the stack top and store it in x. If x is not specified, then discard the stack top.
# DUMP x y dumps x to y. y can only be registers, pointed cell, or stack top.
# SWAP x y swaps the value between x and y.
# SORT list sorts the list.
# RST x resets x to initial value.
# WAIT x waits for x milliseconds.
= Super Advanced Commands =
RAND
RANDINT a b
RANDFLT a b
CHOICE list
SHUFFLE list
SRCH list x
LAMBDA foo param_list code END
CALL foo param_list END
# RAND generates a random float number between 0 and 1.
# RANDINT a b generates a random integer between a and b.
# RANDFLT a b generates a random float number between a and b.
# CHOICE list randomly chooses an item from the list.
# SHUFFLE list randomly shuffles the list.
# SRCH list x searches x from list. Return TRUE if x is found, otherwise FALSE.
# LAMBDA foo param_list code END is a lambda expression.
# CALL foo param_list END calls a lambda expression.
= The Very, Extremely, Devastatingly, Whoppingly, Unsurprisingly, Obviously, Absolutely, Universal, Godlike, and ONLY TWO Advanced Commands =
EVAL x
EXEC x
# EVAL x evaluates x and return the result.
# EXEC x executes x as Masqualia code and return nothing.
= Example =
== Hello, world! ==
OUT "Hello, world!"
== A+B Problem ==
IN CURCELL
FWD
IN CURCELL
LOOP
SUB CURCELL 1
BKD
ADD CURCELL 1
FWD
END
BKD
SAY CURCELL
= Note =
# ADD x y <-> x + y
# SUB x y <-> x - y
# MUL x y <-> x * y
# DIV x y <-> x / y
# MOD x y <-> x % y
# OR x y <-> x | y
# AND x y <-> x & y
# XOR x y <-> x ^ y
# EXP x y <-> x ** y
# NOT x <-> ~x
# LAND x y <-> x && y
# LOR x y <-> x || y
# LNOT x <-> !x
(All operation symbols are from Python.)
= Categories and References =
Category:Languages
Category:2025
Category:Turing complete
Category:High-level
Category:Brainfuck derivatives
Category:Cell-based
Category:Stack-based