Giter Site home page Giter Site logo

basemax / dotwhitespace Goto Github PK

View Code? Open in Web Editor NEW
16.0 5.0 2.0 749 KB

DotWhitespace is an esoteric programming language using Python.

License: MIT License

Python 100.00%
programming-language programming-language-theory programming-language-concepts programming-language-development programming-language-design interpreter interpreter-basic interpreter-python python dotwhitespace

dotwhitespace's Introduction

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

$ 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.

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

  • 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 display Hello World, Not HelloWorld)

Similar Projects

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


Max Base

My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. (Max Base)

Asrez Team

A team includes some programmer, developer, designer, researcher(s) especially Max Base.

Asrez Team

dotwhitespace's People

Contributors

basemax avatar donno2048 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

sahwar jbampton

dotwhitespace's Issues

Add credit to Whitespace?

The illustration on this repo is taken from the Wikipedia page for Whitespace -- a language created by Brady and Morris around 2003. But the README says "DotWhitespace is an esoteric programming language developed by Max Base. It was released on 17 July 2020."

Even if dotwhitespace is different, please consider crediting what inspired it in your README and explaining the differences, if any -- especially if you are showing output taken directly from other whitespace-language interpreters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.