Build Your Own WebAssembly Compiler

Поделиться
HTML-код
  • Опубликовано: 12 янв 2025

Комментарии • 33

  • @TheReferrer72
    @TheReferrer72 5 лет назад +23

    Brilliant talk, went into depth fast, unlike most talks that rehash the same adder type webassembly program for most of the talk.

    • @subschallenge-nh4xp
      @subschallenge-nh4xp 5 лет назад

      I started learning web assembly this year may someone explain to me what's going on

    • @ksbs2036
      @ksbs2036 5 лет назад

      @@subschallenge-nh4xp - en.wikipedia.org/wiki/WebAssembly could you be more explicit in your question. What part do you find unclear?

  • @deckarep
    @deckarep 4 года назад +3

    Fantastic talk! Good pace and good depth.

  • @victorarnault
    @victorarnault 5 лет назад +1

    Just finished, I love that.

  • @k98killer
    @k98killer Год назад

    Very cool.

  • @brandonstack4072
    @brandonstack4072 5 лет назад +4

    I love this talk, but I am having a lot of trouble with the byte code on the right at 20:57.
    How is the byte code at 20:57 interpreted?
    I can find 0x43 as the f3.const opcode. But 42 in ieee754 (according to converters and not by hand) should be 0x42280000. Why is the code here 0xcdccb841?
    Also how does the call function work? In the x86 asm I have seen, you would load params into registers, and then call a function reference. But it seems like you are calling a reference at 0 which would be odd. Is that where the console.log function is imported?
    Does the const operation actually load the value into a register so the called function can use it?

  • @dasten123
    @dasten123 5 лет назад +2

    Really, really awesome talk! I love it!!

  • @aloussase
    @aloussase 2 года назад

    awesome talk! what did you use to make the web editor for your language?

    • @KooShnoo
      @KooShnoo 2 года назад +2

      inspect element tells me it's "CodeMirror"

  • @MrHatoi
    @MrHatoi 4 года назад +6

    There's something poetic about the fact that you can now compile Java to WebAssembly. Java has finally come full circle.

  • @k98killer
    @k98killer Год назад

    If only browsers supported Lua instead of JavaScript, we'd probably just be using the Lua register-based bytecode.

  • @mikew2229
    @mikew2229 5 лет назад +7

    so embarrassed at 08:19

  • @victorarnault
    @victorarnault 5 лет назад +3

    WASM was designed for compiling Java too?

    • @acobster
      @acobster 5 лет назад +7

      WebAssembly was designed as a _compilation target_ from any language, including Java. That means WASM doesn't have to know anything about Java, but rather vice versa: Java (or whatever language you're writing in) just has to know about the WASM format, and output code in that format. Any modern browser will know how to run the WASM code your compiler outputs.

    • @MrQwerty2524
      @MrQwerty2524 5 лет назад +1

      Java uses LLVM. That means Java can be compiled to Wasm. Which also means that Kotlin can be compiled to wasm. Funnily enough.

    • @my2iu
      @my2iu 5 лет назад +2

      In my opinion, no. The WASM developers have focused almost entirely on C/C++. Although it is theoretically possible to compile anything to anything else, the results will inevitably be sort of lackluster for Java if you don't add proper support for garbage collection, multi-threading, and fast dynamic dispatch into the compilation target itself.

    • @kitpeddler
      @kitpeddler 5 лет назад +4

      @@my2iu That's just... not true. Java bytecode is always translated to native machine code eventually. Translating java bytecode into Wasm is not any more difficult than that.

    • @my2iu
      @my2iu 5 лет назад +4

      @@kitpeddler wasm is higher level and more restrictive than a true native assembly. It imposes extra overhead due to security checks.

  • @sakari_n
    @sakari_n 5 лет назад +6

    javascript was a mistake. I hope this WebAssemply brings us better web.

    • @dasten123
      @dasten123 5 лет назад +1

      What do you mean with better web? I can only think of performance reasons. Anything else?

    • @skepticmoderate5790
      @skepticmoderate5790 4 года назад +3

      @@dasten123 JavaScript is a security nightmare because it's so dynamic and had no module system at it's conception. There's a laundry list of other security problems too.

  • @elziolima8014
    @elziolima8014 5 лет назад +2

    Subtitles for foreigns, please. :)

    • @pictureus
      @pictureus 5 лет назад

      Subtitles are available for this video. Is there a language you're missing?

    • @elziolima8014
      @elziolima8014 5 лет назад

      @@pictureus Auto-generated subtitles are unreliable.

    • @pictureus
      @pictureus 5 лет назад

      @@elziolima8014 Yes, but still. If someone were to translate for you; they must know your language in advance.

    • @elziolima8014
      @elziolima8014 5 лет назад +2

      @@pictureus I think a reliable English subtitle would help a lot.

  • @xXxBladeStormxXx
    @xXxBladeStormxXx 5 лет назад +11

    "Creating a (simple) compiler isn't that hard"
    That's because what you've built is basically a glorified tree walking interpreter. Not to discourage, but I don't think this can be classified as even a simple compiler.

    • @acobster
      @acobster 5 лет назад +17

      What would a "simple compiler" constitute, if anything more than a program that generates code for a _compilation target_?

    • @dealloc
      @dealloc 5 лет назад +16

      This is what a compiler is; a program that converts its instructions to machine-code (such as WASM or Assembly). Here it converts the instructions from his own language into WASM instructions. Like a compiler. It is then executed by the browser, by passing the code to the browser's WebAssembly executor through an API.

    • @xXxBladeStormxXx
      @xXxBladeStormxXx 4 года назад

      @FichDich InDemArsch no u