Giter Club home page Giter Club logo

logicode's Introduction

Logicode

Welcome to Logicode!

Logicode is a minimalistic language that is mainly based on Logisim.

Because of that, the only built-in commands are AND, OR and NOT, and you make the rest.

The three logic gates are represented like so:

  • a&b: AND of a and b.
  • a?b: OR of a and b.
  • !a: NOT of a.

There are more built-ins:

  • *: Random bit, either 0 or 1.

You can make extra things from these commands, like circuits and variables.

##Make-your-own Things

###Circuits To create a circuit, you have to do this:

circ circuit_name(arg1, arg2...)->{what the function does}

circ is the circuit "declaration", and everything after the -> is interpreted as code.

###Variables To create a variable:

var var_name=value

var is the variable declaration.

###Conditions To create a condition:

cond arg->{executed if arg = 1}/{executed if arg = 0}

cond is the variable declaration, arg is either a value of 0 or 1, and the / is the separator of the two executing strings.

##I/O

###Output There is also output as well:

out out_value

out is the output declaration, and you can include the built-in commands, as well as self-made circuits, into the output to be processed.

##Example code:

circ xor(a,b)->(!(a&b))&(a?b)
var test=xor(1,1)
out !(test)

Output: 1

The circuit xor calculates the XOR of two bits, and test is declared as the XOR of 1 and 1 (which is 0). Then, the out outputs the NOT of test, which is 1.

logicode's People

Watchers

 avatar  avatar

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.