Git Product home page Git Product logo

wsdt / almostbinary Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 0.0 29.78 MB

Compiler & Runtime for 'Almost Binary'. Code in platform-independent binary and utilize high-level data structures and state-of-the-art libraries (e.g. quantum computing, blockchain, ..)

License: GNU General Public License v3.0

C# 80.37% Dockerfile 0.32% HTML 18.64% Q# 0.67%
binary compiler runtime csharp programming-language esoteric-programming-language esolang platform-independent blockchain quantum-computing qsharp

almostbinary's Introduction

Almost Binary HitCount Maintenance GitHub license Generic badge Donate Codacy Badge

This compiler & runtime will be improved continuously. Please be clement, as this is my first time implementing a compiler and runtime.

Take a look at the documentation: Almost Binary - Wiki

Code Once, Run Everywhere. Tests within Docker

Code in platform-independent Binary. It was never so easy to proof that you are a real geek.

This programming language is made for people, who..

  • ..always wanted to code in Binary.
  • ..love real challenges.
  • ..want to bring their programming skills to the next level.
  • ..want to run binary-programs on any machine.

Example

You will find some example files here. Simple hello-world program:

0000000000000000011010010110110101110000011011110111001001110100
000000000000000001110011011110010111001101110100011001010110110100000000000000000000000000000000000000000000000000000000000000000110011001110101011011100110001101110100011010010110111101101110
0000000000000000000000000000000001001101011000010110100101101110
0000000000000000000000000000000000000000000000000000000000101000
0000000000000000000000000000000000000000000000000000000000101001
000000000000000000000000000000000000000000000000000000000111101100000000000000000000000000000000000000000000000000000000010100000111001001101001011011100111010001001100011010010110111001100101
0000000000000000000000000000000000000000000000000000000000101000
0000000000000000000000000000000000000000000000000000000000100010000000000000000000000000000000000000000001001000011001010110110001101100011011110010000001010111011011110111001001101100011001000000000000000000000000000000000000000000000000000000000000100010
0000000000000000000000000000000000000000000000000000000000101001
00000000000000000000000000000000000000000000000000000000000000000101001001100101011000010110010001001100011010010110111001100101
0000000000000000000000000000000000000000000000000000000000101000
0000000000000000000000000000000000000000000000000000000000101001
0000000000000000000000000000000000000000000000000000000001111101

Of course you can remove all tabs and newlines. Removing spaces is only supported in some cases as I didn't want to introduce too much delimiters (e.g. 8 zeros).


Libraries

This is an exhaustive list of all implemented AlmostBinary libraries:

Identifier/Name (x64): 0000000000000000011100110111100101110011011101000110010101101101

Description: Default functions, e.g. PrintLine, InputString, ...

Identifier/Name (x64): 00000000000000000000000000000000000000000000000001100010011011000110111101100011011010110110001101101000011000010110100101101110

Description: Create simple proof-of-work blockchains, create transactions, validate the blockchain and mine abin-Coins.

Identifier/Name (x64): 0000000001110001011101010110000101101110011101000111010101101101

Description: Utilize a small part of the Q# simulator api. E.g. create true random number.


Why I made this

Esoteric languages like WhiteSpace, Brainfuck or Arnold-C have inspired me to write my own compiler & runtime. In the very beginnings of my programming-journey, I thought that programmers and hackers code today's applications in Binary. As most, even non-tech people, know today, this is not the case. The closest you can get is actually coding Assembly or if you know Assembly really well, even real machine code. Nevertheless, coding in real binary is incredible difficult and runs only on a set of processors. Thus, you will have to adapt your binary code to the target machine.

This project should make it possible to write platform-independent binary. Of course, you are not coding in real binary, like you would if you go the assembly way. Thus, some "binary" code written will be compiled to normal strings and other binary-strings will be interpreted at runtime.

TO-DOs

Contribution Open Source Love svg2 PRs Welcome

This project is licensed under GNU V3, so contributions/pull-requests are welcome. All contributors get listed here.

Contributors saythanks

  • Kevin Riedl (WSDT)

Additional notes

Almost Binary is supposed to be an esoteric programming language and is surely not suitable for real-world programs.

More resources

Template

This project was inspried by Klip.

almostbinary's People

Contributors

codacy-badger avatar dependabot[bot] avatar wsdt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

almostbinary's Issues

varName = InputString() badly parsed

InputString() and varName alone are working.
But in one line the Parsing doesn't work..

Take a look at Parser.cs:ParseAssign():
name = InputString() is parsed as name = InputString --> InputString as value instead of function interpreted.

Possible solution: Add a new ParseFunctionAssign() or modify ParseAssign() to support function assignment.

Runtime does not interpret

Cannot interpret any of the compiled files?
Might be just a small bug, but solve BEFORE making greater changes in compiler.

Example: repeat.abin
Problem seems to be the TokenList.Position cursor (wrong set).

This and similar errors (sometimes also related to Call (verify esp.):

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at AlmostBinary_Runtime.Lexer..ctor(String c) in C:\Users\WSDT\Desktop\C#_.NET\KevinRiedl\AlmostBinary\AlmostBinary_Runtime\Lexer.cs:line 45
   at AlmostBinary_Runtime.Runtime..ctor(String c) in C:\Users\WSDT\Desktop\C#_.NET\KevinRiedl\AlmostBinary\AlmostBinary_Runtime\Runtime.cs:line 23
   at AlmostBinary_Runtime.Startup.Run(String[] args) in C:\Users\WSDT\Desktop\C#_.NET\KevinRiedl\AlmostBinary\AlmostBinary_Runtime\Startup.cs:line 42
   at AlmostBinary_Compiler.Program.Main(String[] args) in C:\Users\WSDT\Desktop\C#_.NET\KevinRiedl\AlmostBinary\AlmostBinary_Runtime\Program.cs:line 28

Working compiled file (by original compiler):

�:Main
.repeat0
pushString "hello world"
call PrintLine
goto .repeat0
ret
:Print
print
ret
:PrintLine
printLine
ret
:Read
read
ret
:ReadLine
readLine
ret
:InputString
inputString
ret

Non-working compiled file:

î�.repeat0
pushString "hello world"
call PrintLine
goto .repeat0.repeat0
pushString "hello world"
call PrintLine
goto .repeat0
:Print
print
ret

:PrintLine
printLine
ret

:Read
read
ret

:ReadLine
readLine
ret

:InputString
inputString
ret

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.