Тёмный

Q&A: Making Programming Language Parsers, etc 

Jonathan Blow
Подписаться 85 тыс.
Просмотров 40 тыс.
50% 1

This is the Q&A that happened after the discussion at • Discussion: Making Pro... .

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 117   
@fourscoreand9884
@fourscoreand9884 4 года назад
Thanks for these, Jonathan. You are so cool, man.
@Singularitarian
@Singularitarian 4 года назад
The Elements of Computing Systems by Nisan and Schocken is one book you can read that teaches you how to make a simple compiler.
@weakamna
@weakamna 4 года назад
A really nice book. It does a really good job of simplifying everything down to the barest minimum (as they quote in the book: "as simple as possible, but not simpler").
@Singularitarian
@Singularitarian 4 года назад
@@weakamna Yeah, as someone who previously did not understand how computers work, doing all the projects in that book was a hugely enlightening experience. Very impressive how simple a computer can be.
@MarcoGiordanoTD
@MarcoGiordanoTD 4 года назад
@@Singularitarian arent they the same guys from nand to tetris? I loved that course! I loved their content and teaching style
@Singularitarian
@Singularitarian 4 года назад
@@MarcoGiordanoTD Yeah, it's the "Nand 2 Tetris" textbook. You create a computer that can play Tetris from scratch, starting with nand gates.
@MarcoGiordanoTD
@MarcoGiordanoTD 4 года назад
@@Singularitarian yeah, they host a class made from the book material on coursera. That is where I did it and learnt about them
@RobertHildebrandt
@RobertHildebrandt 4 года назад
1:11:48 I like the Rust syntax for references: 1) It is consistent when getting a reference type or value 2) It is familiar Type of a reference pointing to unsigned integer: let ptr: &u32; Get reference to value: ptr = &x; Dereference: x = *ptr;
@bool2max
@bool2max 4 года назад
so just like c-style pointers except using the & when declaring a reference?
@RobertHildebrandt
@RobertHildebrandt 4 года назад
@@bool2max Yap :)
@RobertHildebrandt
@RobertHildebrandt 4 года назад
Note: In rust they aren't called pointers because rust also has pointers declared with * only allowed to be dereferenced in unsafe code and because the borrow checker does not verify the lifetime of the object and jada jada jada... But aside from the compile-time validation they effectively are (as you said) just C-pointers with & while declaring them.
@sherwinparvizian2414
@sherwinparvizian2414 4 года назад
1:10:05 Not just Finland, but probably everyone using QWERTZ keyboards. On them you usually have to press the caret key twice to produce any input which often results in 2 caret characters.
@JhoferGamer
@JhoferGamer 3 года назад
yeah, its annoying, but I guess it is to support letters like ê
@garad123456
@garad123456 3 года назад
Scandinavian keyboard is qwerty though but yeah the carrot thing is real
@sabokizi
@sabokizi 9 месяцев назад
as someone from europe, its quite common though for programmers to move away from keyboard layouts that have deadkeys. I know a few who even moved over to the standard american layout because of how bad the symbols are on nordic layouts.
@jonatan.cirqueira3925
@jonatan.cirqueira3925 8 месяцев назад
In Brazil we have that suffering with ` Sometimes helps to press the dead key and then spacebar Idk how Jai is rn but copying the Rust-reference syntax would be a good choice like someone suggested here
@andreymramornov9226
@andreymramornov9226 4 года назад
I've wrote my first compiler (alas for fake machine that had its own interpreter) using "LET'S BUILD A COMPILER!" by Jack Crenshaw. I recommend it because its a very practical guide, with a lot of simple code and no PhD bs (even though PhD wrote it). It's also freely available on internet.
@Rankao
@Rankao 4 года назад
For the rant at 25:00 I think part of it is to take a lot of information with grain of salt. Ultimately there has to be some sort of fundamentals you go off of. It's not easy to know who is right and who is wrong when you're learning something new. Especially when some aspects of programming starts edging towards a Craft vs a Science.
@mercipher
@mercipher 4 года назад
You made a lot of (probably fair) assumptions about wasm, but it actually seems to defy most or all of them. Wasm is just a very very bare-bones stack machine, that web browsers happen to implement as a sandboxed vm. Web assembly (or at the very least, the 1.0 MVP) actually doesn't really have anything to do with the browser at all. You can't manipulate the DOM, you can't call into any kind of browser API, it only has 4 types: i32, i64, f32, f64, and you can't touch anything outside of the 'sandbox' unless it is explicitly passed in.The creators seem to have been exceedingly careful about keeping the browser out of scope. Anyway I don't think wasm will be perfect and I'm not married to it, but it may be worth looking into if you actually wanted something like what you described.
@thetastefultoastie6077
@thetastefultoastie6077 4 года назад
What are computers? _Computers used to be people_ True fact.
@BinaryReader
@BinaryReader 4 года назад
WASM is maybe that bytecode you're referring to with web distribution, and WASI being that system interface? EDIT: Saw someone mentioned WASM/WASI and the follow on hostile attack on the competence of web programmers. Need to be mindful of that Johnathon, there are a subset of web programmers that know what they're doing. Additionally, WASM is not coupled to the browser, maybe look into it.
@jblow888
@jblow888 4 года назад
Fool me 24 times, shame on you. Fool me 25 times, shame on me.
@kristupasantanavicius9093
@kristupasantanavicius9093 4 года назад
Plot twist: all good JS programmers could also program C/++
@kiwec
@kiwec 4 года назад
"WASM is not coupled to the browser" Funny how WASM is only used in browsers and how you can't do anything without accessing JavaScript APIs.
@BinaryReader
@BinaryReader 4 года назад
​@@kiwec Yeah, its pretty funny wasmer.io/ github.com/WAVM/WAVM github.com/bytecodealliance/wasmtime github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone Writing a WASM runtime doesn't seem particularly challenging, standardization around WASI will probably be a thing in the coming years. But whatever, just another thing to poke fun at.
@jouniosmala9921
@jouniosmala9921 4 года назад
Solution to parsing issue. You first go through the source code and operate the operand that ties in strongest, then you go through the source code looking for operators that tie in next strongest until you don't have anymore operators to go through and you have parsed every single operations. You can speed things up by replacing variable names and numbers in the source code by numbers, and those numbers are indices to an array that contains the variable names and values. Now the best part, use three letter acronyms for every variable name in the compiler/interpreter and don't use any comments in the source code. Now Imagine how much fun you would have coming back to that project 6 months later. When my harddrive crashed in middle of trying to figure out what that code did all I felt was relief that I didn't have to see that source again.
@_slier
@_slier 3 года назад
is this pratt parsing?
@trolledwoods377
@trolledwoods377 4 года назад
Learning a lot before doing or learning a lot by doing is like building lego with instructions vs designing lego without instructions :P
@elvircrn
@elvircrn 4 года назад
1:17:55 - can someone give more info (with more specific example, possibly) on this topic for those of us who aren't exactly familiar with the history of computer graphics? How does d3d retained mode relate to the current/future state of tensorflow?
@Muskar2
@Muskar2 8 месяцев назад
25:12 I.e. meritocratic educational platform. I've thought about such a thing on and off for years, so I can highly relate.
@avery_IO
@avery_IO 2 года назад
"when i first wrote parsers as a little kid" lmao casey and i did not have the same childhood XD 9:45
@giffiyt
@giffiyt 3 года назад
1:10:02 that came out of nowhere and i started to laugh so hard xDD (i'm finnish).
@oj0024
@oj0024 4 года назад
What was meant by a imideate mode tensorflow replacement? Isn't that something similar to pytorch?
@Singularitarian
@Singularitarian 4 года назад
I'm also curious to hear more about this. Do the criticisms of TensorFlow apply equally to TensorFlow 2?
@bennettbullock9690
@bennettbullock9690 2 года назад
It would be nice if you included descriptions of people you admire alongside the many people you think are incompetent. It's a bit alienating and it makes your otherwise good videos that much more difficult to watch. Perhaps your intended effect is to bring viewers into your inner circle, but eventually we all start to get the haunting realization that because we didn't build our own game engine we just don't measure up.
@meanmole3212
@meanmole3212 2 года назад
Don't listen to the people of Finland considering characters like ^. The default layout of any standard keyboard is ridiculous for programming. Rebinding characters like {()}\[]/ should be mandatory for everyone (I typed that with my 1 hand's fingers and did not move my hand at all, I used to the other hand to trigger a modifier key). Similarly the character ^ which requires shift + TWO sequential presses of the key for ^ is just stupid. There's no reason why that requires shift and 2 presses instead of one, if you are going to stay with default garbage layout. Maybe I remember the original way to output ^ wrong but it was not easy or sensible. Best regards from Finland.
@drdca8263
@drdca8263 4 года назад
If someone hasn’t made a compiler or interpreter before, and they want to make a toy compiler, should they first make an interpreter?
@elipeery7930
@elipeery7930 4 года назад
Absolutely. Compilers are orders of magnitude more complicated.
@ratgr
@ratgr 4 года назад
@@elipeery7930 Compilers are basically an interpreter
@elipeery7930
@elipeery7930 4 года назад
@@ratgr Compilers are like interpreters in the sense that they both take human readable code as an input. Compilers have the extra requirement of being able to generate efficient machine code. This ends up making compilers much more difficult to implement, especially for someone has never built one before.
@ratgr
@ratgr 4 года назад
@@elipeery7930 What I meant is compilers interpret intermediate representations and return machinecode
@ratgr
@ratgr 4 года назад
Yes, just go through the intermediate representation route, then adding a compiler is adding a custom interpreter for that code
@Mike.Garcia
@Mike.Garcia 4 года назад
58:00 what's that website mentioned there?
@thexinoip
@thexinoip 4 года назад
I think it's this one: cdecl.org/
@Mike.Garcia
@Mike.Garcia 4 года назад
@@thexinoip cool thanks 👍
@francescocozzuto3870
@francescocozzuto3870 4 года назад
thanks dude
@bies_moron4404
@bies_moron4404 2 года назад
17:35
@eugenej.5584
@eugenej.5584 4 года назад
I just don't understand modern programmers. Why, instead of inventing the operator precedence problem, not simply allow functions to have operator like names and use lisp syntax....
@TanmayPatil37
@TanmayPatil37 2 года назад
parentheses
@rupammandal468
@rupammandal468 4 года назад
isn't discord uses elixer??
@zilluss
@zilluss 4 года назад
Rupam Mandal the backend yes, when he says Discord is written in JS they’re talking about the frontend
@thexinoip
@thexinoip 4 года назад
It's written in electronjs frontend
@varunvarma5424
@varunvarma5424 4 года назад
@@zilluss I thought they recently moved their backend to Rust?
@zilluss
@zilluss 4 года назад
Varun Varma I think your right thanks for the correction!
@32gigs96
@32gigs96 4 года назад
Varun Varma no, from what I heard they use rust in elixir to implement certain data structures that don’t work well in functional code
@johnhammer8668
@johnhammer8668 4 года назад
SVN . huh..
@joshuadonahue5871
@joshuadonahue5871 4 года назад
He doesn't like git's poor support for binary assets, among other things probably
@in0lasc0
@in0lasc0 4 года назад
@06:25 I've been working for the last 10 years in web programming and I have to say... I 100% agree. The JS community in particular is too busy "inventing problems" that don't really exist to then propose a "clever" solution, usually in the form of stacking layers and layers of unnecessary abstractions, just to make up for programmer incompetency. These days I shudder whenever people say "modern javascript" (as if all JS is "obsolete" in some way), it usually just means JS with some poorly thought out new feature or syntactic sugar that some feel they're obligated to use even if it adds nothing.
@GodOfMacro
@GodOfMacro 4 года назад
I think I agree with you but not sure, by "modern" javascript you mean ES2015+ or just the way ppl write code, trying to npm install all the problemes away ? Because while bloated, the newest "modern" version of the languages isn't just sugar, and sugar as nice as arrow functions does help. (they also fix arguments & this, which isn't just sugar) I've learn in 2015 and really feel like old school js is obsolete.
@_slier
@_slier 3 года назад
the most toxic community ever..when i was started, there is js library like jquery, mootools, prototype, scriptaculous..then come react, angular, abc, def, ghi...then the build system, babel, bower, webpack, grunt, gulp for fuck sake, i really want to see js die...disgusting community ever
@alexplisov
@alexplisov 4 года назад
Guys, you are the best! Just want to say, thank you very much!
@nyrtzi
@nyrtzi 4 года назад
The first language I wrote (a dynamic simple Forth with a macro system) was crap but I learned a lot about how to not make a programming language.
@theitatit
@theitatit 4 года назад
Lol, maybe programming is all about learning how not to do things
@nyrtzi
@nyrtzi 4 года назад
@@theitatit That's definitely a big part of it. However usually one doesn't know what's wrong until it's already in production and too late to fix.
@McWickyyyy
@McWickyyyy 4 года назад
I know this has nothing to do with this video but...you inspired me with The Witness. It is art. Keep up the good work with whatever you do in life. I was giving some thought to the title of the game recently. Perhaps the title The Witness has to do with something very interesting that I just thought about. When I first played this game I streamed it and people started watching. I had about 10-20 people who watched me play this game all the way through. Why? Because they had already played it and wanted to see someone else experience it and struggle through it for the first time. It hasbeen 2-3 years since I have played the game and I am now currently showing the game to my dad. He is playing through the game and he is getting frustrated and stuck on the same parts I did. There is no reason for me to go back and play the game myself since I already know all the rules and most of the solves. However...i now understand why so many people enjoyed watching me play the game for the first time a few years ago...it’s the same reason I enjoy watching my dad struggle through the puzzles. It’s because I can experience the game “for the first time” again by watching someone else play the game and have that experience. It truly was and is an amazing experience. Perhaps the ultimate value and infinite replay value comes from the perspective of the person watching the game being played by someone for the first time and not actually playing the game itself...aka the viewer is the witness. And you only realize this value months or years after you play the game yourself...when you introduce the game to someone else and watch them play it. Suddenly your perspective changes and you now understand the title...just like in the game where sometimes stuff doesn’t make sense until time passes and your perspective changes. Whether that’s the true meaning or not I don’t know...but I am quite impressed with this game. I always will be. This game affected me in such a way that no other game could. Anyways...
@BillyLemonZest
@BillyLemonZest 2 года назад
I listened to the whole conversation in 1 go, both original and Q&A. Always inspirational, enlightening, funny, and heats the nearly dead embers of my conviction.
@kim15742
@kim15742 3 года назад
So my introduction to programming was through Minecraft. For all the lifte time I wasted with that game and the fact it's Java, it was a pretty tangible way of programming and it motivated me to research creating my own game engine
@alexnoman1498
@alexnoman1498 4 года назад
1:26:30 Sooner or later it's about education more than changing the world yourself. I followed Alan Kay for a long time, exactly the same thing. Education's so important, yet in horrible shape. We're actively wasting generations of humans.
@Beefster09
@Beefster09 4 года назад
TIL a gay wedding is the same as a straight wedding
@zarathoustracapital3571
@zarathoustracapital3571 3 года назад
I don't know very much about WASM but I know the naïve concept I just described is better. Love the hubris.
@LambOfDemyelination
@LambOfDemyelination 4 года назад
JIT is terrible? Why's that?
@monke5100
@monke5100 Год назад
It's basically just a hack. Instead of using a compiled language in the first place you try compiling an interpreted one. There's no good reason to do so if you really think about it, just compile ahead of time
@LambOfDemyelination
@LambOfDemyelination Год назад
@@monke5100 the reason is usually for cross platform purposes though. compiling jit for a language is less trivial than just compiling aot
@Caesim9
@Caesim9 3 года назад
The first part about "solving" software distribution is what Android is doing. Their .dex files are platform independent byte code. And all Android system calls are in byte code only. And when an app gets installed it gets compilated.
@MateuszSkutnik
@MateuszSkutnik 4 года назад
while I understand about 1% of this, I love listening to it while designing a game. :D
@akshayazariah
@akshayazariah 4 года назад
Haven't watched the whole thing yet, but Jai doesn't have a bootstrapping compiler (yet), right?
@_slier
@_slier 3 года назад
nop, still in c++...its not Jon main focus atm..
@riomh
@riomh 4 года назад
Can't wait for the talk on computers and education! :)
@ilmarinen79
@ilmarinen79 4 года назад
On the carot thing: thank you for even considering. Feels annoying when you (we) need to push another key after to see the character...probably would get used to it though. Enjoyable Q & A BTW
@nyrtzi
@nyrtzi 4 года назад
This is how I've experienced it: Setting up a new Go project on a new machine: 1) Unzip Go from the website into the right place 2) Run "apt install vim git" 3) Copy over my .vimrc and .gitconfig 4) Install Vundle for Vim and run ":VundleInstall" inside Vim 5) Start working Setting up a new Javascript project on a new machine: 1) Install version control 2) Install a tool that autogenerates a working project from a template (so hard to get it right otherwise that they've had to make a tool for it?) 3) Generate a project from a template 4) Try to tweak it until all the essential aspects are correct (exactly the right kind of enforced automatic code formatting) plus all the necessary libraries 5) Give up in frustration after having wasted days on it Setting up something very quick and dirty isn't a problem with Javascript. The problems don't become apparent until you want full control and high quality. Maybe it would work better if I were to cargo cult the exact tool set that everyone else uses for that stuff.
@IgorStojkovic
@IgorStojkovic 4 года назад
To all the (Finish?) people that have issues with typing "^" just download www.microsoft.com/en-us/download/details.aspx?id=22339 and create your own keyboard layout that will make what ever you need to type easy. On Linux you can also create a new layout by editing /usr/share/X11/xkb* files: rlog.rgtti.com/2014/05/01/how-to-modify-a-keyboard-layout-in-linux/ askubuntu.com/questions/482678/how-to-add-a-new-keyboard-layout-custom-keyboard-layout-definition
@Pangeli70
@Pangeli70 4 года назад
As an exercise, on how to build compilers, I'd like to help rebuild the Jai compiler using... Jai
@____uncompetative
@____uncompetative 3 года назад
carets are good for your eyesight making pointer declaration and access easier to read.
@adrianojordao4634
@adrianojordao4634 3 года назад
You need to know about regular expressions, do it in C becose you want to implement instruction set in assembly.
@_slier
@_slier 3 года назад
using * for declaring pointer and get the address of variable is seems like a good idea for me...it looks consistent..using ^ or " for dereferencing pointer is much better than using
@abhishekkadam2999
@abhishekkadam2999 3 года назад
And yes, that is it's official name "wasi..or whatever the hell that is".
@SimGunther
@SimGunther 3 года назад
6:44 XDDD
@blakebaird119
@blakebaird119 Год назад
Love a good Casey JB code talk
@blakebaird119
@blakebaird119 Год назад
Also just expanding on the point early on In the talk: much technical information on the internet is like the review section on Amazon. Majority of reviews seem like they are written the day or week that the customer received the product. One counter point to the argument is that I have heard it said that right after you learn something is when you’re in the best position to help someone else overcome the hurdle you just overcame.
@b3nn3b28
@b3nn3b28 4 года назад
Go firefox! But why Firefox instead of chrome?
@hanes2
@hanes2 4 года назад
If u have to ask, u just don’t get it so many years later.
@b3nn3b28
@b3nn3b28 4 года назад
@@hanes2 oh I didn't look at the timestamp of video LOL
@davidjohnston4240
@davidjohnston4240 4 года назад
Check out Verilog for a language that made a complete dog's dinner of multidimensional array (or vector) declaration and access.
@10bokaj
@10bokaj 3 года назад
Dud Verilog is for hardware
@MarcosScheeren
@MarcosScheeren 4 года назад
So Jon watches Lex Fridman!? Just speculating LOL.. Btw, would be nice to see Jon on Lex's podcast, but after his presentation on education. ps. Really awesome 5 hours of insightful content!
@efzet76
@efzet76 3 года назад
Hi, Just wanted to suggest an alternative for the
@icesentry
@icesentry 4 года назад
Do you have an opinion on www.craftinginterpreters.com at least as a starting point? Also, related to the WASM point, I understand your resentment of the web, but do you agree that essentially everyone has access to a web browser therefore targeting that let's you target more people than targeting a specific OS? I agree that the web as produced a lot of bad stuff, but I'm not sure why targeting browsers for IR bytecode is inherently bad.
@darthtesla301
@darthtesla301 4 года назад
It's a better experience without the twitch chat
@TheXello
@TheXello 4 года назад
Hey Jonathan, I love your stuff! One point you might find interesting is how much you use the phrase "I feel like" I think you mean to say "I think". Feelings are for things like sad, happy, mad, upset, they are about your state of mind. Thinking is about how you perceive the world. I find it is helpful to not mix the two. I understand that the definition of "I think" has connotations of "I know" thanks to how people use it.
@Zipperheaddttl
@Zipperheaddttl 4 года назад
Oh dude, you are gonna run into so many problems saying I think instead of I feel, saying I think this means (in a lot of people's head) "if you do think this then you are wrong." Saying I feel means "this is the way I feel but it's ok if you feel a different way." It took me way to long to learn this, but when I did life became much easier.
@TheXello
@TheXello 4 года назад
@@Zipperheaddttl yeah when I started using I think rather than I feel I was worried about that too. But it really has not been a problem for me. As a bonus I get to communicate my feeling. For example, I can say "I feel frustrated". Also, saying I feel can result in most people dismissing your ideas. I am not saying everyone should use "I think". But if you are helping to correct issues around development, adjusting communication to be more accurate might be worth doing. Finally, if someone gets upset or nasty about you using "I think". Then they probably need some help. Either your thoughts are non-consequential or they need to calmly and professionally figure out if your thought has merit. And if they don't, they need to explain to you why in a professional manner.
@Zipperheaddttl
@Zipperheaddttl 4 года назад
@@TheXello I mean yeah that would be nice. But I think most people would have trouble telling their boss that.
@TheXello
@TheXello 4 года назад
@@Zipperheaddttl well, the way I see it is either you accept that your boss and your company has no respect for you and your teammates, or you start to inform them that what they are doing is not professional and not helping the company. I worked for a place where all the employees kept rolling over. It got really terrible. But Yes, in the end it is your call.
Далее
Новый вид животных Supertype
00:59
Просмотров 160 тыс.
CORTE DE CABELO RADICAL
00:59
Просмотров 1,9 млн
Watermelon magic box! #shorts by Leisi Crazy
00:20
Просмотров 11 млн
Real Programmers Write Machine Code
26:25
Просмотров 112 тыс.
Compiler Q&A, September 2024
2:10:03
Просмотров 23 тыс.
Fast and Beautiful Assembly
34:28
Просмотров 11 тыс.
Jonathan Blow on how an operating system should work
14:22
Jonathan Blow - Truth In Game Design
48:02
Просмотров 61 тыс.