DotWhitespace is an esoteric programming language created by Max Base. It was released on July 17, 2020. Its name refers to the characters of white space and dots. Unlike most programming languages, which ignore most white space characters or give less meaning. Only distances, tabs, dots and lines are meaningful.
$ python DotWhitespace.py examples/hello-world.ds
.. . . . . . .. . . . . .
$ cat examples/hello-world.ds | python DotWhitespace.py -
Output: hello world
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
.. . . . .
.. . . . .
.. . .
.. . . . . .
.. . . .
It is actually equivalent to:
.S.S.SS.SSS.T.S.SS.SSS. ; DEFINE abc ('STR', 'abc')
.S.S.SS.SSS.TT.S.SS.SSS. ; DEFINE abc ('VAR', 'abc')
.S.S.SS.SSS.TSS.SSS.SSSS.S. ; DEFINE abc ('NUM', 1230)
..ST.S.SS.SSS. ; PRINT ('VAR', 'abc')
..S.S.SS.SSS. ; PRINT ('STR', 'abc')
..SSS.S. ; PRINT ('NUM', 10)
..SSS.S.S.TSSS.S. ; PRINT ('NUM', 120)
..SSS.S.STSSS.S ; PRINT ('NUM', 120)
Output:
1230
abc
10
120
120
This language was inspired by Whitespace.
However DotWhitespace is not a whitespace interpreter, and the grammar is different in many ways.
It also has dots, For example:
There are only three types of commands in this language.
S
means whitespace character.
- Print to console (String or Number directly or from a variable)
..S
- Read input from console (not yet developed); I need help from others.
...S
- Variable definition
.S
T
means tab character. (\t
)
Syntax | Operator |
---|---|
T | + |
TT | - |
TTT | * |
TTTT | / |
TTTTT | ^ |
TTTTTT | % |
Note: There are no parentheses, So the priority of the operators will not support all mathematics expression.
You can pass -debug
argument, then you will see debug information in stout.
e.g: $ python DotWhitespace.py examples/hello-world.ds -debug
or $ python DotWhitespace.py -debug examples/hello-world.ds
Output:
('PRINT', ('STR', 'hello world'))
hello world
- Input:
. . . . .\t. . . .\n
DEFINE abcd ('STR', 'abcd')
- Input:
. . . . .\t\t. . . .\n
DEFINE abcd ('VAR', 'abcd')
- Input:
. . . . .\t . . . .\n
DEFINE abcd ('NUM', 1230)
- Input:
.. \t. . . .\n
PRINT ('VAR', 'abcd')
- Input:
.. . . . .\n
PRINT ('STR', 'abcd')
- Input:
.. . .\n
PRINT ('NUM', 10)
- Input:
.. . . .\t . .\n
PRINT ('NUM', 120)
- Input:
.. . . \t . \n
PRINT ('NUM', 120)
(space)abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+?<>[]{}
Note: You will not be able to print any characters other than the above.
-
Implement float number.
-
Display Tree of program.
-
Implement Read Input. (
input()
in python orscanf()
in c, one for read string and another for number) What about reading a line or float number! -
Implement loop (
for
) -
Implement if, and else (
if(...){} else{}
) -
Implement logical operators (
> < >= <= ==
)
- 2020-07-23: Get filename from argument and reads from file.
- 2020-07-23: Adding
whitespace
(\s) as supported character. (e.g: we want to displayHello World
, NotHelloWorld
)
- https://github.com/BaseMax/MiniCalculatorInterpreter
- https://github.com/BaseMax/CFG2CNF
The grammar idea for this language was first taken from Whitespace, but these have nothing to do with each other and are different in many ways.
Thanks to Prof. Jeremy Douglass for mentions this to me. #1
My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. (Max Base)
A team includes some programmer, developer, designer, researcher(s) especially Max Base.