WTF is an Abstract Syntax Tree?

Sdílet
Vložit
  • čas přidán 25. 10. 2021
  • Potential interview question: What is an Abstract Syntax Tree?
    #shorts #programming #compsci
  • Věda a technologie

Komentáře • 325

  • @ktsnowy
    @ktsnowy Před 2 lety +1612

    I would love a video/tutorial explaining how a compiler works.
    Maybe even teaching how to make our own programming language.

    • @nivaldolemos5280
      @nivaldolemos5280 Před 2 lety +84

      there're a like a ton of books and university semester courses on this subject, a video tutorial would be way too long to teach you well.

    • @simonfj20
      @simonfj20 Před 2 lety +92

      @@nivaldolemos5280 a little overview of the subject wouldn't hurt. In my experience, a lot of the material online is very hard to get started with or just very overdetailed step by step tutorials.

    • @riddixdan5572
      @riddixdan5572 Před 2 lety +11

      @@nivaldolemos5280 so a series it is then

    • @kissgergo5202
      @kissgergo5202 Před 2 lety +14

      @@nivaldolemos5280 The same is true for the languages and concept that this channel has already covered but the videos are still good. As far as I'm concerned, the point of videos like X in 100 seconds series isn't to teach you everything there is to know about the given subject but to get you interested so you go seek out more information.

    • @yadneshkhode3091
      @yadneshkhode3091 Před 2 lety +5

      compiler just converts High level code to machine code
      Even I dont remember exactly
      1. Identify variables and their values
      tokenization
      making AST and so on there were 7-8 steps as far as I remember

  • @socketbyte5348
    @socketbyte5348 Před 2 lety +901

    Insane timing, I've just started developing my programming language today.

    • @Fireship
      @Fireship  Před 2 lety +229

      lol

    • @69bruh
      @69bruh Před 2 lety +169

      @@Fireship top 10 times fireship stalked people

    • @markasgrazhulis9081
      @markasgrazhulis9081 Před 2 lety +9

      what's the language called?or the name of the github repo

    • @karl2883
      @karl2883 Před 2 lety +2

      Yes, for me it was a few days ago

    • @socketbyte5348
      @socketbyte5348 Před 2 lety +34

      @@markasgrazhulis9081 Well, like I said, I've just started designing it. Still deciding on the syntax, but it will probably be a JVM language since I know bytecode pretty well. I could use LLVM but that would require a bit more work since my language will probably be more high level and use a GC which JVM provides out of the box. Planning to do a hybrid of functional and imperative languages but for JVM platform. Java interop probably won't be natively (or seamlessly) supported since my language won't enforce or even probably support most of the object oriented paradigms. Should be pretty fun to develop though!

  • @shantanukulkarni007
    @shantanukulkarni007 Před 2 lety +393

    If an interviewer asks me what is abstract syntax tree. I would ask myself what did I apply for?

    • @eldattackkrossa9886
      @eldattackkrossa9886 Před 2 lety +119

      abstract syntax gardening probably

    • @1Joren
      @1Joren Před 2 lety +28

      You might be surprised at how often they come in handy though. As a JS developer, I find myself needing AST pretty often for static analysis, making a codemod to make migration easy on my consuming devs, creating an eslint plugin, creating reports/manifests for projects. It's pretty niche, but not entirely crazy uncommon.

    • @aybak3k
      @aybak3k Před 2 lety +3

      XDDDDDDDDDDDDDD
      underrated comment

    • @neoney
      @neoney Před 2 lety +4

      only used an AST once, that was to draw text with markdown-like formatting support in html5 canvas.

    • @yunier91
      @yunier91 Před 2 lety +5

      You could be working on a framework, a Domain language, a RESTful API or even GraphQL. Syntax tree are pretty common. An extremly useful.

  • @snurf69
    @snurf69 Před 2 lety +329

    Fun fact:
    "Ast" is the german word for tree branch.

  • @nathanadhitya
    @nathanadhitya Před 2 lety +168

    How to create your own programming language interpreter/compiler next? 🤔

    • @yassin_eldeeb
      @yassin_eldeeb Před 2 lety +51

      jeff: create your own programming language in a 100s 😂😂

    • @ktsnowy
      @ktsnowy Před 2 lety +6

      @@yassin_eldeeb That would be awesome

    • @vishnus5531
      @vishnus5531 Před 2 lety +4

      +1

    • @roland144
      @roland144 Před 2 lety +7

      I recommend the "How to write an interpreter in Go" and "How to write a compiler in Go" books. They're really great, I'm using them right now to create my own toy language (translating the code from Go to Rust, though, since I want to get better at that).

    • @mustafalair9494
      @mustafalair9494 Před 2 lety +1

      @@roland144
      I really really want that book but can't buy it
      Payment isn't supported in my country
      it just keeps saying "Sorry, this item is not available in your location."
      can you help with that please?

  • @Hydridity
    @Hydridity Před 2 lety +33

    Exactly the type of videos I need while doing compiler for course project assignment at university

    • @THEMAXIMOSMAX
      @THEMAXIMOSMAX Před 2 lety

      Tamu junto meu irmao

    • @codeaperture
      @codeaperture Před 2 lety

      What is context free grammar?

    • @chairedge
      @chairedge Před 2 měsíci

      ​@@codeapertureit is grammar, but it does not depend on a context

  • @P4shaPlays
    @P4shaPlays Před rokem +1

    Interviewer: What's an abstract syntax tree?
    Me: Have a nice day.

  • @Akshay-dn7ni
    @Akshay-dn7ni Před 2 lety +4

    Me: It is a type of binary tree
    Interviewer: 👀

  • @MichaelRoberts9000
    @MichaelRoberts9000 Před 2 lety +1

    Teaching entire semesters in seconds using memes.

  • @razvanrujoiu2290
    @razvanrujoiu2290 Před 2 lety +1

    This is the best, shortest and concise explanation that i found on the internet 😆

  • @roastyou666
    @roastyou666 Před rokem +2

    What a timing! My high school’s advanced placement class just started teaching about compilers and this video popped up! 😮

  • @LioncatDevStudio
    @LioncatDevStudio Před 2 lety +4

    We need a series where you make a compiler/interpreter

  • @codelif
    @codelif Před rokem +11

    Basically HTML is the true programming language.

  • @casper75559
    @casper75559 Před 3 měsíci

    It’s funny cause it still applies even the second time around😅😭

  • @Offiziersmesser
    @Offiziersmesser Před 3 měsíci

    Flashbacks form my compiler construction class.

  • @MechMK1
    @MechMK1 Před 3 měsíci

    Important: An AST does not necessarily need to be valid. The parser may detect syntax errors, but the lexer will detect further semantic errors, such as assigning a value to a read-only variable.

  • @leafyon
    @leafyon Před 4 měsíci

    Thanks bro. I’m gonna use this information and absolutely flunk my advanced programming class now

  • @adityadandage6028
    @adityadandage6028 Před 4 měsíci

    Damn, please upload more like these. I just love your content!!

  • @deesh6378
    @deesh6378 Před 2 měsíci +1

    Having written my own script parser, this gave me ptsd.

  • @xodix1416
    @xodix1416 Před 2 lety +3

    I'm just making a compiler. STOP READING MY MIND

  • @natescode
    @natescode Před 3 měsíci

    I WISH I had that interview question

  • @MercyFromOverwatch2
    @MercyFromOverwatch2 Před 2 lety +1

    Jeff is still my favourite tech youtuber

  • @jaysonbunnell8097
    @jaysonbunnell8097 Před 2 lety +7

    IVE BEEN STUCK WRITING A DANG AST FOR SO LONG!! I’m trying to write it in JS, but with high portability (so I can rewrite it in a faster language). I have a fully functioning tokenizer+lexer, but the AST generation is so confusing. would LOVE a more in depth video!! Great contents as always.

    • @traniel123456789
      @traniel123456789 Před 2 lety

      I find it most helpful to develop it together with the compiler. Neither makes any sense by itself. I am surprised there isn't more of a general standard for AST formatting though.

  • @lifeok6188
    @lifeok6188 Před 2 lety +1

    I introduced myself within 10 seconds 😂

  • @devmo9474
    @devmo9474 Před 2 lety +1

    Before i fall asleep yesterday as a dead body, i took a deep wide breath and i wisely said to my self: The compiler is more genius than just compile your written shit. Now I know.

  • @dubble_cuppachino
    @dubble_cuppachino Před rokem +1

    For those who are now eager to make their own programming language, your next google clues are: "lexer" and "parser"

  • @xenialxerous2441
    @xenialxerous2441 Před 2 lety

    Wow! Awesome stuff. This gave me an insight as to how the compilers/transpilers work under the hood. TYSM!!

  • @krtirtho
    @krtirtho Před 2 lety +3

    With the AST of a programming language one can even manage to write a compiler for JS which compiles JS to Machine Code (will be tough as JS is dynamic + WEAKLY TYPED)

    • @nilstrieb
      @nilstrieb Před 2 lety

      That's btw exactly what JS engines like v8 in Chrome or Spidermonkey in Firefox do. It fully possible, that the JS which displays this comment was actually run in machine code.

  • @Qwetzxl
    @Qwetzxl Před 2 lety

    That joke in the beginning lmfao epic gamer moment lmfao

  • @priyanshupriyam174
    @priyanshupriyam174 Před měsícem

    Interesting timing, i just had my lex and yacc quiz today

  • @chintu2691994
    @chintu2691994 Před 4 měsíci

    This was worst nightmare to learn and yet critical important thing to learn😅😅

  • @first-thoughtgiver-of-will2456

    Me:
    "I don't answer questions".

  • @tw04
    @tw04 Před 2 lety +4

    New series for interviews? like it

    • @shapelessed
      @shapelessed Před 2 lety

      Wouldn't mind it at all... I'd especially want to know how not to shit all of your confidence out on an interview when forget the answer to a question that's so simple a kid would know it...

  • @bogdan.vilimonovic
    @bogdan.vilimonovic Před rokem

    Bruh i had a class in college where we've made an interpreter for mini C, like ive practically done this, but when he said that term my mind was absolutely blank

  • @gf408
    @gf408 Před 2 lety

    I literally posted a tutorial on how to make a basic lexer parser and interpreter yesterday and you post this! awesome timing

  • @Bebopttv
    @Bebopttv Před 4 měsíci

    I tried to watch but the music had me jamming out. Great vid!

  • @jaysonbunnell8097
    @jaysonbunnell8097 Před 2 lety

    If you do a language building tutorial, could you please do one that included curly braces?? all the existing tutorials are basically lisp-syntax languages that don’t help much.

  • @davosonic60
    @davosonic60 Před 2 lety

    Hey I love this new video format for vertical screens.

  • @Frejherning
    @Frejherning Před 2 lety

    Love these shorts!

  • @snode373
    @snode373 Před 2 lety

    This stuff is the best! especially for people really studying the language at heart!

  • @Cydio
    @Cydio Před 2 lety

    And there’s my entire course in one video

  • @sillynephele
    @sillynephele Před 3 měsíci

    I was just working on my compiler project lol.

  • @jorgeguerrero4353
    @jorgeguerrero4353 Před rokem

    I took that class last semester. It was such a nightmare of a class..😢😢😢

  • @13thk
    @13thk Před 2 lety

    I've just finished developing my programming language and this... Awesome

  • @noname_hacke_9747
    @noname_hacke_9747 Před 2 lety +1

    U said u will make a full rust tutorial

  • @mainaksanyal9515
    @mainaksanyal9515 Před rokem

    Interviewer: What is AST?
    Me: Let me tell you where is it used.

  • @slashxred
    @slashxred Před 2 lety

    I feel like a shorts class for java would be sick

  • @scheimong
    @scheimong Před 2 lety

    The most useful CZcams short ever

  • @falxie_
    @falxie_ Před 2 lety

    I'll just send this to my interviewer next time

  • @JB-fh1bb
    @JB-fh1bb Před 2 lety

    This is why I wish we had AST/lexical-aware git.

  • @minecraftus9504
    @minecraftus9504 Před 2 lety

    The first clip is actual perfect meme 👌🏻

  • @siliconhawk9293
    @siliconhawk9293 Před 27 dny

    I forgot about AST then you started explaining and i was like oh yeah i learned about this in my compiler course. Fuk

  • @AribBabar
    @AribBabar Před 2 lety

    Wow, I literally just started learning this in college

  • @jeremiahblessing3891
    @jeremiahblessing3891 Před 2 lety

    I just started to learn xtext and language parsers, and now you release this. Bruh how

  • @teabags2day
    @teabags2day Před rokem +1

    Interviewer: "Can you tell me what an AST is?"
    Me: "FIRESHIP VIDEOO WTF IS AN ABSTRACT SYNTAX TREE?"! 🥺

  • @marcellmunnich1094
    @marcellmunnich1094 Před 2 lety

    Literally just finished my compiler assignment for uni, it's like you can read minds... Implementing an AST generator for the first time was tough!

  • @babaganaabba785
    @babaganaabba785 Před 2 lety

    I can’t believe this came after we just finished a course on this😂😂😂

  • @quiescentheartboi5059
    @quiescentheartboi5059 Před 2 lety

    you are my favorite CZcamsr ❤️

  • @dailybit300
    @dailybit300 Před 2 lety

    He is going deep now.

  • @spectrm6014
    @spectrm6014 Před 2 lety

    I'm working on my own programming language at the moment and it's compiled. Making a compiler is a pain in ass :')

  • @davidgillies620
    @davidgillies620 Před 2 měsíci

    An easy way to see what one looks like is to poke around in the internals of a GraphQL query object.

  • @SpinozicTroll
    @SpinozicTroll Před rokem

    You big time need to put a de-esser on your voice. It would sometimes be a preset inside of a regular compressor. Just tweak around the frequency knob to detect your harsh "s" or adjust the threshold.

  • @hotmeal8531
    @hotmeal8531 Před 2 lety

    Theres this blog called lets build a simple interpreter by ruslan spivak. I learned way to create custom asts from it. Its great👍🏼

  • @ioshaven436
    @ioshaven436 Před 2 lety

    For those wondering it’s much easier to write a grammar using tools which generate abstract code for parsing the AST. Tools like Antlr are the way to go for yet another DSL.

  • @AnirbaannChakraborty
    @AnirbaannChakraborty Před 2 lety

    Just got a flashback from the time I studied Compiler Design as a paper in my CS Masters.....

  • @ryanc4015
    @ryanc4015 Před 2 lety

    *Interview
    Me: Let me explain it less than 100 seconds..

  • @nickscurvy8635
    @nickscurvy8635 Před 2 lety

    It's a superclass of a SyntaxTreeImpl

  • @artrix909
    @artrix909 Před 2 lety +3

    time to make a language called fireship 😉😉😏😏

  • @gauravsingh1963
    @gauravsingh1963 Před 2 lety

    Thankyou for this video, very informative

  • @_b001
    @_b001 Před 2 lety +1

    Me: *a tree that is abstract ??*

  • @MJ-ih1yu
    @MJ-ih1yu Před 2 lety

    Recruiter: What is AST?
    ME: 🤔🙄🏃🏃🏃🏃🏃🏃

  • @Jerios
    @Jerios Před 2 lety

    video idea: haxe in 100 seconds

  • @arvindrawat3641
    @arvindrawat3641 Před 2 lety

    The first video ive come across for 'system software' subject topic😂

  • @thatGuyWithTheFunnyName

    Insane video thank you, just understood what I'm doing 😂😂making my own language using lisp core functions... Thank you

  • @josephzamer5802
    @josephzamer5802 Před 2 lety +1

    when I was just getting hot finished, nooooooooooooo!
    jokes apart, you explain 6 month of compiler theories better than my professor at college

  • @Ejioplex
    @Ejioplex Před rokem

    Finally one thing I already knew!

  • @xd-fu6ry
    @xd-fu6ry Před 2 lety

    Can you do a video on Meteor? it's coming back in 2021 from the dead they got some VC funding to continue development

  • @philipmrch8326
    @philipmrch8326 Před 5 měsíci

    I have this at uni right now

  • @j4kna
    @j4kna Před 2 lety

    Truly insane timing. I just finished a compiler of my own for my Regular Languages and Compilers class. How the fuck do you know google?

  • @AdroSlice
    @AdroSlice Před 2 lety

    Next video: "Writing a compiler in 100 seconds" :D

  • @yadneshkhode3091
    @yadneshkhode3091 Před 2 lety

    engineers already learnt this in compiler theory subject

  • @Dexter-lw4xv
    @Dexter-lw4xv Před 2 lety

    Bro... I love you

  • @dhavalparekh6813
    @dhavalparekh6813 Před 2 lety

    You are awesome!!!!

  • @aid154r
    @aid154r Před 2 lety

    can i know which code editor this is ....its so cool...and fancy.🙃

  • @JohnWasinger
    @JohnWasinger Před 2 lety

    Use flex and bison. They’re the updated versions of lex and yacc. (Yet another compiler compiler).

  • @conordunne3831
    @conordunne3831 Před 2 lety

    I created a compiler for my Bachelor's Final Year Project and this just gave me PTSD

  • @1Eagler
    @1Eagler Před 4 měsíci

    Having done a tutorial compiler....
    Me,me,me

  • @teckyify
    @teckyify Před 2 lety

    I don't think you can understand this video without already knowing a bit about compilers, syntax, parsers, etc.

  • @piyush9555
    @piyush9555 Před rokem

    music was awesome

  • @carpetworms_
    @carpetworms_ Před 2 lety

    Is this also used in the compile time detection security technique

  • @rashidzia7628
    @rashidzia7628 Před 4 měsíci

    oh i know this, i studied compiler construction in college

  • @romanboiko9576
    @romanboiko9576 Před 2 lety

    When you need metaclasses, you don't need metaclasses - this sounds for me the same...

  • @CyborusYT
    @CyborusYT Před 2 lety

    R.I.P TotalBiscuit....

  • @0xbyt3z
    @0xbyt3z Před 2 lety

    i really wants to know how lexical analysis works on classes and functions

  • @Youraverageprogrammer
    @Youraverageprogrammer Před 2 lety

    *instantly hired*

  • @dranaxel
    @dranaxel Před 2 lety

    It's oddly short with an abrupt ending, is this normal ?

  • @fateriddle14
    @fateriddle14 Před 2 lety

    Not a CS major, one of my pain is people talking about "runtime" code vs "compile time" code, I look up the word and seem to understand in a vacuum, but once people use those words in a sentence, I just feel they mean different than what I modelled in my mind, do you care to make a video about it? Thanks.

  • @brianevans4
    @brianevans4 Před 2 lety +2

    how to create a programming language in 100 seconds

    • @brianevans4
      @brianevans4 Před 2 lety

      can use javascript template string literals as input btw

  • @osamatawfeq
    @osamatawfeq Před rokem

    What is the theme you are using?!!

  • @iampuff7
    @iampuff7 Před 2 lety

    what's the best AST lib for typescript?