Sujet : Re: transpiling to low level C
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 19. Dec 2024, 01:32:47
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vjvpjf$2gsil$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Mozilla Thunderbird
On 18/12/2024 05:55, Lawrence D'Oliveiro wrote:
On Tue, 17 Dec 2024 22:55:53 +0000, bart wrote:
On 17/12/2024 22:25, Lawrence D'Oliveiro wrote:
>
On Tue, 17 Dec 2024 19:45:49 +0000, bart wrote:
>
It's not aimed at people /implementing/ such a tool.
>
It is aimed at those capable of following the links to relevant specs.
>
It also a pretty terrible link.
Did you see this link
<https://developer.mozilla.org/en-US/docs/WebAssembly/Reference>? Lots of
examples from there.
I promised a example of Hello World using my IL, and how to process and run it, in half a page. This is it for Windows :
------------------------------------
Paste the indented code into a file hello.pcl:
addlib "msvcrt"
extproc puts
proc main:::
setcall i32 /1
load u64 "Hello World!"
setarg u64 /1
callf i32 /1 &puts
unload i32
load i32 0
stop
retproc
endproc
Download the pc.exe file here:
https://github.com/sal55/langs/blob/master/pc.exe, which is a 65KB file (UPX-compressed from 180KB). (Advice to navigate AV not included here.)
At a command prompt with both files present, type:
pc -r hello
This will convert it to x64 code and run it. Use 'pc' by itself to see the 6 other processing options.
------------------------------------
So 20 non-blank lines. It would be nice if an equally simple example existed for WASM/WAT, or if people who suggested that choice could post a link to such an example /that/ works on Windows.