WEBASSEMBLY STACK MACHINE | Introduction to WebAssembly (WASM)

Поделиться
HTML-код
  • Опубликовано: 9 сен 2024
  • this video gives you a brief tutorial into webassembly and how the webassembly stack machine operates.
    chris first shows you how webassembly does math calculations using stacks by hand, and then in javascript. we then hand code squares, echo, multiply, add, subtract functions in webassembly text format (WAT) and then compile into WASM and executing in node.js. this video will get you super deep into understanding how webassembly operates under the hood.
  • НаукаНаука

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

  • @rebolyte
    @rebolyte 2 года назад +3

    Excellent intro! Starting with an understanding the foundation is great - no libraries, no dependencies, minimal tools. Please cover more topics 👏

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

    dude your videos are solid gold, please continue to make more!

    • @chrishayuk
      @chrishayuk  3 года назад

      Thaaaanks that’s really kind of you to say, I have a few more webassembly ones in the pipeline. Glad it was useful

  • @user-ng8rl3jb1i
    @user-ng8rl3jb1i Год назад +1

    hi, nice videos. I'm more like into circuits in general (like working with verilog), but I find this web assembly very interesting

  • @xtremewolve
    @xtremewolve 3 года назад +1

    Another fine video.

  • @rmschindler144
    @rmschindler144 Месяц назад

    note that you don’t need the `-o` flag when calling `wat2wasm`, and it will simply use the filename

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

    Very helpful, thanks!
    Btw pretty cool short notation for params is (func $multiply (param i32 i32) (result i32) (i32.mult (local.get 0) (local.get 1)))

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

      it's a good point.. i shyed away from doing short notation for simplicity but then forgot to mention it altogether, lol. great comment

  • @ArlindoHonkRP
    @ArlindoHonkRP 2 года назад +1

    Excelent video, deserves more views!

  • @DysoniaMultiverseNews
    @DysoniaMultiverseNews 2 месяца назад

    For example, RPN for stack is like the following: Like doing math vertical when in school
    100 (first number entered... Bottom of Stack)
    10 (Second Number entered (Higher up in stack or on top in this case))
    - ___________ ( Do the mathematical operation: Subtract )
    Hope the format remains.

    • @DysoniaMultiverseNews
      @DysoniaMultiverseNews 2 месяца назад

      Will be interesting when doing something particularly fancy like complex compound math sequences and also with loops. I think we can do it with enough getting our minds around the syntax. The most extreme would be understanding how the binaries work on the instruction by instruction level and wrapping our minds around that and write it in a HEX EDITOR (old days, we called that ML Monitors).

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

    At 9.48 you could just write return stack.pop() * stack.pop(), since push followed by pop is the identity function

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

      we know that, he jsut try to replicate to stack machine as close as possible.

  • @pss_crs
    @pss_crs 3 года назад +1

    Why video like this have 39 views, thanks you gave me great thoughts 👍.

    • @chrishayuk
      @chrishayuk  3 года назад

      Thanks :) I hope it will get more views too, glad it was thought provoking

  • @enjoywatching2700
    @enjoywatching2700 2 года назад +1

    very nice 👍👍👍

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

      Thank you very much, glad you liked 😀

  • @When_am_I
    @When_am_I 2 года назад +1

    Why didn’t I learn 1st grade math from you sir!

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

      i'm hoping that was a complement, lol

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

      @@chrishayuk yes sir, definitely a compliment!

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

    Lovely video, but this from ChatGPT: Alan Turing did not invent the stack. The concept of a stack in computer science predates Turing's work. The stack is a fundamental data structure used in computer science and programming, and its origins can be traced back to the early development of electronic computers.
    The concept of a stack was introduced as part of the von Neumann architecture, which is the foundation for most modern computer systems. This architecture, proposed by John von Neumann in the mid-1940s, included the idea of a "last in, first out" (LIFO) storage mechanism, which is the fundamental characteristic of a stack.
    So, while Alan Turing made many significant contributions to computer science and mathematics, he was not the inventor of the stack. The concept of the stack emerged as a natural component of the early computer architectures.

    • @chrishayuk
      @chrishayuk  Год назад +1

      the implementation of the turing machine is single-stack pushdown automaton which is fundamentally a stack. so it does pre-date von neumann architecture, sure the concept of a stack as we know it today was formalized in von neumanns work but remember the two worked together in princeton prior to this. i stick with my claim in terms of computing turing invented the stack, even if it wasn't formalized as that

    • @lynndemarest1902
      @lynndemarest1902 Год назад +1

      @@chrishayuk I, and Chat GPT, stand corrected! Never mind. Great video. Thank you! This stuff is moving fast for an old man like me! :)

    • @lynndemarest1902
      @lynndemarest1902 Год назад +1

      en.wikipedia.org/wiki/Stack_(abstract_data_type)#:~:text=Klaus%20Samelson%20and%20Friedrich%20L,invention%20of%20the%20stack%20principle.

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

      @@lynndemarest1902 no worries, tough to keep track of these things, glad you enjoy and find the vids useful

  • @stal1963
    @stal1963 3 месяца назад +1

    Not Alan Turing invented the stack, but F.L. Bauer and Samelson invented it independently in the 1920s. -> en.m.wikipedia.org/wiki/Stack_(abstract_data_type)