first reason for need standard mapping from VM to Hack rather cryptic

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

first reason for need standard mapping from VM to Hack rather cryptic

Rather Iffy
This post was updated on .
The first reason provided for need for a standard mapping from vm to a target platform, such as Hack, confuses me very much.

On page 141:
" These guidelines, called standard mapping, are provided for two reasons. First, they entail a public contract that regulates how VM based programs can interact with programs produced by compilers that don't use this VM, e.g., compilers that produce binary code directly.). Second ... run standardized tests .....  "

Is there a standard mapping from vm to each specific individual target platform, so if there are for instance, besides Hack ,  99 other target platforms in this world today , then  there are 100 defined standard mappings ? Or is there 1 vm  standard mapping defined and every target platform somehow has to conform to that?

Is a Jack program a VM-based  program?  What does VM-based mean in this context?

If a compiler could compile a Jack , or for that matter a Python program, directly into Hack assembly without the use of the vm virtual machine model, then how can a standard mapping of only the vm to Hack step , which is only the second stage, somehow ensure proper interaction?

I read the text many times; maybe the text is just too cryptic.
I have finished the vm translator  in Python, so precise understanding of this text fragment is not necessary for the construction of the translator. But for getting the bigger picture it would be nice to understand it properly.

Reply | Threaded
Open this post in threaded view
|

Re: first reason for need standard mapping from VM to Hack rather cryptisch

Shimon Schocken
Administrator
I admit that chapters 7 and 8 are a bit cryptic here and there, and promise to fix it for the next edition.

The VM implementation discussed in Chapters 7/8 describes how VM programs (i.e. programs written in the VM language described in the book) should be translated to the *Hack Platform*.  If you wish to execute such VM programs on some other hardware platform, then, indeed, you need another translator, and another specification.

In general, if someone comes up with a new hardware platform (e.g. a new cellphone processor), and wishes to execute VM programs on this platform, it is his/her responsibility to supply a spec that describes how these VM programs should be translated to the machine language of the target platform.

I hope that this helps.  -- Shimon
Reply | Threaded
Open this post in threaded view
|

Re: first reason for need standard mapping from VM to Hack rather cryptisch

Krozu
This post was updated on .
Am i correct to assume that this is how it (more or less) works?
Compiler translates from a HLL to a VM language that it supports, the VM Translator works its magic on the VM language and turns it into the ASM it supports, and after that the Assembler turns the ASM into Machine Code for the hardware and that every piece of hardware needs its own Assembler?

High Level Language to Machine Language
Reply | Threaded
Open this post in threaded view
|

Re: first reason for need standard mapping from VM to Hack rather cryptisch

cadet1620
Administrator
Correct, except that I'd call the data between VM and Machine Language "Assembly Language (ASM)." HDL stands for "Hardware Definition Language," and defines the embodiment of the system architecture including the machine language.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: first reason for need standard mapping from VM to Hack rather cryptisch

Krozu
Fixed the image / text, should have seen that when i was typing. Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: first reason for need standard mapping from VM to Hack rather cryptic

sankar.lp.gym
This post was updated on .
In reply to this post by Rather Iffy
To know more about hardware definition language

www.eng.auburn.edu/~strouce/class/elec4200/vhdlintro.pdf‎


[advertising link deleted. --admin]