Coder Social home page Coder Social logo

go-porth's Introduction

Go Porth (Naive 1x1 Go translation from porth.py sim)

This translation is based on commit 5da80c1

The idea was not to write "idiomatic Go". I tried to translate 1x1 without any fancy modification to the original code. It was a relly cool experience.

The main project is hosted in Porth

My very fast computer specs:

CPU: Intel Celeron N3050 (2) @ 2.160GHz
GPU: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx
Memory: 1859MiB / 3852MiB

Native porth simulator

$ ./porth.py sim examples/rule110.porth
...
real    0m4,876s
user    0m4,769s
sys     0m0,048s

Go Porth simulator

$ go build -o porth main.go
$ ./porth sim examples/rule110.porth
...
real    0m0,026s
user    0m0,017s
sys     0m0,007s

I know that the comparation is very silly, but it is what it is, I also know that the language is meant to be self hosted, but again I enjoyed the exercise.

Tests

~/projects/go-porth$ ./test.py
[INFO] Testing ./tests/bitwise.porth
[CMD] ./porth sim ./tests/bitwise.porth
[INFO] Testing ./tests/arithmetics.porth
[CMD] ./porth sim ./tests/arithmetics.porth
[INFO] Testing ./tests/comparison.porth
[CMD] ./porth sim ./tests/comparison.porth
[INFO] Testing ./tests/memory.porth
[CMD] ./porth sim ./tests/memory.porth
[INFO] Testing ./tests/control-flow.porth
[CMD] ./porth sim ./tests/control-flow.porth
[INFO] Testing ./tests/stack.porth
[CMD] ./porth sim ./tests/stack.porth

Simulation failed: 0

go-porth's People

Contributors

drocha87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.