how to run oxygenbasic into wasm

Started by Alberto Curiel, July 16, 2023, 04:47:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Alberto Curiel

hi,

how to compile oxygenbasic programs into wasm?

chatgp says via emsdk, renaming the oxygenbasic extension, but when running emsdk, wasm says file type not found.

wasm to run the program on internet.
I want to run oxygen programs on internet's browsers.
is it possible?

or at least, could oxygenbasic run/talk wasm code/modules?

thank you
  •  

Charles Pegge

I have not heard of WASM before. Reading the Wikipedia page it seems to be associated with Javascript, as a means of coding in a series of instructions rather than high level language expressions.

Alberto Curiel

Hi, wasm is wanted to be run on browsers,
you can compile programs and run them in there.
you can run python, or redis server inside wasm,
blockchains are being running on it..

A WebAssembly virtual machine that allows developers to write code in their preferred languages and run it at near-native speeds
https://wasm0.io/

blockchains including Ethereum and Tron, have claimed to support WASM bytecode in their next generation VM engines

so you are running compiled programs into web browsers.

one data an position common acroos different machines, operating system and languages:

We believe WebAssembly (Wasm), and the multitude of languages that compile to Wasm, are an ideal alternative to EVM. Wasm is a standard for web browsers developed by W3C workgroup that includes Google, Mozilla, and others. It was developed so that code can be deployed in any browser with the same result. Wasm is high performance—it's built to be as close to native machine code as possible while still being platform independent. It facilitates small binaries to ship over the internet to devices with potentially slow internet connection. There's been many years of work put into Wasm, both by compiler and standardization teams.


so with wasm, it could be possible to a program written in basic, compiled, run  the exe inside the browser, independently of the hardware that it is running , or operating system. the same program running on windows, unix, mac servers.
and also, the data, the same allocation of memory is in every program executed which, warranties the blockchains safety. so, the same spaces,position in memory equal, independently of the machine or operating system running.

what it "lacks by design"for example is some i/o, but there have been extensions added, by languages like in python,rust, to add that functionallity.$

note:..that remembers me the high frame macro computers from decades ago, but now, that technology running on pcs.


so, i was thinking... running oxygenbasic compiled exe inside webbrowsers, regardless of the Operating system or browser user.
(or at least on browsers, .exe on windows).

 ;D

for fun, and of course the AI say it is easy:

ChatGPT

To connect OxygenBasic programs with WebAssembly language, you will need to use the Emscripten toolchain. Emscripten is a compiler tool that allows you to compile C, C++, and other languages into WebAssembly.

Here is an example program in OxygenBasic that connects with WebAssembly:

```basic
' Import the functions from WebAssembly module
external "C" function AddNumbers(a as integer, b as integer) as integer

' Call the WebAssembly function
dim result as integer = AddNumbers(5, 10)

' Print the result
print "Result: " & result
```

To compile this OxygenBasic program to WebAssembly, you will need to follow these steps:

1. Install the Emscripten toolchain on your system. You can find installation instructions on the official Emscripten website (https://emscripten.org/docs/getting_started/index.html).

2. Save the above OxygenBasic program to a file named "program.obc".

3. Open a terminal and navigate to the directory where the "program.obc" file is located.

4. Run the following command to compile the program to WebAssembly:

```
emcc program.obc -o program.html
```

This command will use the Emscripten compiler (`emcc`) to compile the OxygenBasic program to WebAssembly and generate an HTML file (`program.html`) that can be executed in a web browser.

5. Open the generated "program.html" file in a web browser to see the result.

Note that in order for the OxygenBasic program to connect with a WebAssembly module, you will need to have the WebAssembly module already compiled and available as a JavaScript file or embedded into the HTML code. The OxygenBasic program can then use the `external` keyword to import the functions from the WebAssembly module for interaction.

 ::)

it is the kind of global unification of data programs services, in same memory, and modules in wasm can run as standalone microservices too.

  •  


Charles Pegge


Theo Gottwald

Why should I  give them my Sourcecode directly on their server?
Whats the advantage?
As long ass i can  have a  full Workstation on my table with at least somehow "private data"?
This is - like the whole  "Cloud Thing" another attempt to get control of our binary.

Anyway it may be of use for learning and  special cases, like schools and people who have no own (real) computer but just a  "WEB-Terminal".

Charles Pegge

If you wanted to deploy a browser app that required high performance computation, WASM compiled functions can be used in the JavaScript.

But its not exactly Assembler, it's a stack machine more like JVM. I think a virtual CPU with opcodes and registers would have been a better fit, to emulate the binary of any compiled or JIT language.

Zlatko Vid

QuoteThis is - like the whole  "Cloud Thing" another attempt to get control of our binary.

Yes Theo ..i agree ..i don't like that to.  >:(
  •  

Charles Pegge

This is all food for AI :) It could be really good or really bad depending on who controls it.


There are a few features of JavaScript which I am interested in, like objects. I could make Oxygen translate more easily  to Javascript. This would be the essential first step before considering WASM.