jserv / full-stack-hello Goto Github PK
View Code? Open in Web Editor NEWminimal instruction set and assembler/compiler for "Hello World" execution
License: Other
minimal instruction set and assembler/compiler for "Hello World" execution
License: Other
Got:
➜ full-stack-hello git:(master) ✗ make check
tests/hello.s pass
tests/test.s pass
Expect:
➜ full-stack-hello git:(master) ✗ make check
Hello
tests/hello.s pass
42
50
150
tests/test.s pass
Recently, @pakls contributed a series of conditional branch instructions which enables further translation from higher level languages to our virtual machine. However, lacking of labels prevents jump instructions from being efficiently used.
Thus, we expect that assembler can recognize labels as the indicators of open/close loop or deterministic location.
Need DIV and MOD instructions to do useful mathematics.
Maybe somehow we can generate bytecode, and run from bytecode? without assemble_from_file
.
This is a naive idea at its infancy: Integrate this VM based code with native code.
Allowing them to invoke each other.
Some assumptions/limitations may have to be imposed to speed up the execution and data type conversion.
If the format of an instruction takes two parameters, as_exec crashes if the code is written with only one operand.
While executing test runner with Python2, I got the following error:
File "tests/runner.py", line 38
class TestRunner(unittest.TestCase, metaclass=TestRunnerMeta):
^
SyntaxError: invalid syntax
Cc. @mlouielu
Need SHIFT, OR, XOR, NOT support to do useful logical operations.
Hi, All, I am implementing the support of this. :)
Currently, the instruction set implementation is host specific. That is, if current host is 64 bits, then the in VM and everything will be 64 bits, and vice versa.
I think this can be a goal for this VM, to make it a Turing complete VM (programmign language / instruction set ?)
Some reference:
At the moment, DIV and MOD considers divide-by-zero (I'll call it as DBZ from now on) as unimplemented.
We are in need of an exception handling mechanism when DBZ happens.
I can think of a few ways now:
The considerations that I can think of by now. They are tradeoffs during most of the time.
A. Speed
B. VM Complexity
C. Support of higher level semantics, such as C++ Exception
Error: instruction `halt
' not found
make: *** [Makefile:30: tests/test_halt.done] Error 1
commit: 73432bf, can't pass the test suite:
FFF
======================================================================
FAIL: test_coverage (__main__.TestRunner)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/runner.py", line 38, in test
self.assertEqual(got, expected)
AssertionError: b'' != b'42\n50\n150\n'
======================================================================
FAIL: test_halt (__main__.TestRunner)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/runner.py", line 38, in test
self.assertEqual(got, expected)
AssertionError: b'' != b'42\n'
======================================================================
FAIL: test_hello (__main__.TestRunner)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/runner.py", line 38, in test
self.assertEqual(got, expected)
AssertionError: b'' != b'Hello\n'
----------------------------------------------------------------------
Ran 3 tests in 0.001s
FAILED (failures=3)
make: *** [Makefile:36: test] Error 1
Currently, only ^Hello can be printed. Need to support space character, such as
'Hello World', or "Hello World"
to be a real 'Hello World' full-stack demo.
@jserv maybe is time to open ci for build status and PR build check.
Should this instruction set be given a sound name?
Current design about opcode implement hook is to hook the corresponding implement to each instruction in env->insts
, which the insts is read from file.
Should it be hook on an opcode impl list, then each instruction only need to call from env->impl[opcode](...)
, this should be more efficient for memory usage and hooking stage.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.