https://github.com/basemax/dotwhitespace
DotWhitespace is an esoteric programming language using Python.
https://github.com/basemax/dotwhitespace
dotwhitespace interpreter interpreter-basic interpreter-python programming-language programming-language-concepts programming-language-design programming-language-development programming-language-theory python whitespace whitespace-interpreter whitespace-language whitespace-normalization
Last synced: 14 days ago
JSON representation
DotWhitespace is an esoteric programming language using Python.
- Host: GitHub
- URL: https://github.com/basemax/dotwhitespace
- Owner: BaseMax
- License: mit
- Created: 2020-07-18T05:11:33.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-14T17:37:48.000Z (over 3 years ago)
- Last Synced: 2025-05-04T21:45:36.938Z (15 days ago)
- Topics: dotwhitespace, interpreter, interpreter-basic, interpreter-python, programming-language, programming-language-concepts, programming-language-design, programming-language-development, programming-language-theory, python, whitespace, whitespace-interpreter, whitespace-language, whitespace-normalization
- Language: Python
- Homepage:
- Size: 731 KB
- Stars: 16
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dot-Whitespace Interpreter
## DotWhitespace Programming Language
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.
![]()
### Hello, World in `.Whitespace`
#### From a file
`$ python DotWhitespace.py examples/hello-world.ds`
```
.. . . . . . .. . . . . .
```#### From standard input
```sh
$ cat examples/hello-world.ds | python DotWhitespace.py -
```Output: `hello world`
### Sample Program
```
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
.. . . . .
.. . . . .
.. . .
.. . . . . .
.. . . .
```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
```## Whitespace
This language was inspired by [Whitespace](https://en.wikipedia.org/wiki/Whitespace_(programming_language)).
However DotWhitespace is not a whitespace interpreter, and the grammar is different in many ways.
It also has dots, For example:
## DotWhitespace Commands
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
```### Operators
`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.
### Debug
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
```### Examples
- 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)
### Characters supported as string:
`(space)abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+?<>[]{}`
Note: You will not be able to print any characters other than the above.
### TODO
- Implement **float number**.
- Display Tree of program.
- Implement Read Input. (`input()` in python or `scanf()` 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 (`> < >= <= ==`)### ChangeLog
- [x] 2020-07-23: Get filename from argument and reads from file.
- [x] 2020-07-23: Adding `whitespace` (\s) as supported character. (e.g: we want to display `Hello World`, Not `HelloWorld`)### Similar Projects
- https://github.com/BaseMax/MiniCalculatorInterpreter
- https://github.com/BaseMax/CFG2CNF### Acknowledgments
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](https://github.com/BaseMax/DotWhitespace/issues/1)
---------
# Max Base
My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. ([Max Base](https://maxbase.org/))
## Asrez Team
A team includes some programmer, developer, designer, researcher(s) especially Max Base.
[Asrez Team](https://www.asrez.com/)