Menu

Compile to WebAssembly?

Anonymous
2022-04-20
2022-04-24
  • Anonymous

    Anonymous - 2022-04-20

    Has anyone tried to compile gnuCOBOL to WebAssembly?
    I'm working on a new COBOL project and we need a compiler that's compatible with WASM so that we can have a compiler embedded into a webapp.

    Also, I took a quick look at the code and saw that there was a bunch of platform/OS specific code, I don't have a lot of experience with C, but since WASM is supposed to be crossplatform would it be possible to remove the platform specific code and have a "stripped down" version that can only be compiled to WASM?
    Sorry if this is a stupid question, I'm a frontend dev without much experience with C.

     
  • Simon Sobisch

    Simon Sobisch - 2022-04-24

    The main question is: What should be part of the WebApp? If the answer is "only the running COBOL code" or "only the syntax checks and possibly the translation COBOL -> (internally used) C" then this would be possible, otherwise you'd need to have a C compiler that can handle GnuCOBOL and its big generated intermediate C code files in WebAssembly, too; or replace code generation to output WebAssembly instead of C (not impossible but a huge task).

    Concerning the "platform specific parts" - WebAssembly would likely be an additional one where it could not be part of an already existing one (like clang/llvm for example, at least from what I read using emscripten and llvm was the easiest way two years ago so it is possibly still true today).

     

Anonymous
Anonymous

Add attachments
Cancel