Skip to content

Instantly share code, notes, and snippets.

View lifthrasiir's full-sized avatar

Kang Seonghoon lifthrasiir

View GitHub Profile
@o11c
o11c / every-vm-tutorial-you-ever-studied-is-wrong.md
Last active March 26, 2024 02:31
Every VM tutorial you ever studied is wrong (and other compiler/interpreter-related knowledge)

Note: this was originally several Reddit posts, chained and linked. But now that Reddit is dying I've finally moved them out. Sorry about the mess.


URL: https://www.reddit.com/r/ProgrammingLanguages/comments/up206c/stack_machines_for_compilers/i8ikupw/ Summary: stack-based vs register-based in general.

There are a wide variety of machines that can be described as "stack-based" or "register-based", but not all of them are practical. And there are a lot of other decisions that affect that practicality (do variables have names or only address/indexes? fixed-width or variable-width instructions? are you interpreting the bytecode (and if so, are you using machine stack frames?) or turning it into machine code? how many registers are there, and how many are special? how do you represent multiple types of variable? how many scopes are there(various kinds of global, local, member, ...)? how much effort/complexity can you afford to put into your machine? etc.)

  • a pure stack VM can only access the top elemen

이 글은 안드레이 카패시의 글 소프트웨어 2.0 을 번역한 것입니다. 의/오역이 있을 수 있습니다.


소프트웨어 2.0

나는 때때로 사람들이 뉴럴넷을 "기계학습 도구 상자의 또 다른 도구"로 언급하는 것을 본다. 뉴럴넷은 장단점이 있다. 여기 저기에서 동작하고, 때로는 캐글 경쟁에서 승리하는데 사용할 수도 있다. 그러나 이 해석은 완전히 나무만 보고 숲을 보지 못하는 것이다. 뉴럴넷은 단지 또 다른 종류의 분류기가 아니다. 그것은 우리가 소프트웨어를 작성하는데 있어 근본적인 변화의 시작을 나타낸다. 그것은 소프트웨어 2.0이다.

소프트웨어 1.0의 "고전적인 스택"은 우리가 익숙한 것이다. 그것은 Python, C++ 등의 언어로 작성이 되어 있고, 프로그래머가 작성한 구체적 명령으로 구성되어 있다. 프로그래머는 코드의 각 라인을 작성하는 것으로 프로그램 공간의 특정 포인트를 어떤 원하는 행동으로 확정짓고 있다.