from Hacker News

LL(1) Parser Visualization

by curling_grad on 12/22/22, 11:36 AM with 13 comments

  • by jjice on 12/22/22, 2:46 PM

    Very tangential, but I took a compiler course my senior year of college. It was a graduate level with (in my opinion) one of the best professors in the department. He maintains a known-name ML compiler (not NJ) and has studied language theory his entire career, plus he's an excellent teacher and general person.

    I worked my ass off in the class and it was a blast. Aced all the projects and almost all the homework assignments. The exams were fine too, except one section, parsing algorithms.

    I had just started seeing a girl the week before our week on LR, LALR, LL, etc, and my mind did a lot of wandering during those two lectures. I had everything down for that class, except I had so little knowledge of parsing algorithms. I didn't realize how little I knew until the exam where I lost 30 points to parsing questions. That ended up dropping me to an A-.

    Now whenever I see parsing algorithms mentioned, I get a little laugh. Time with a girl was definitely worth the missed points for a nerdy computer science student.

    This is the site (I believe - there were a few) I used to help scrape a basic understanding together to prep me for the final exam, so I definitely recommend.

  • by Decabytes on 12/22/22, 5:03 PM

    This is very timely. I was browsing the Pharo languages feature list^1 and they described the language as having

    > Since the grammar is LL(1), it is very fast to parse

    and I had never heard of that term before

    1. https://pharo.org/features#Simple_language_syntax_35

  • by carapace on 12/22/22, 2:34 PM

    Reminds me of Python Tutor ( https://pythontutor.com/ )

    (Not to nerd-snipe but it would be fun to write a little doggerel to make Python Tutor draw a parse tree, eh? If you do it please post a link?)

    We need more tools like these.

  • by civopsec on 12/22/22, 4:31 PM

    It seems like examples for these kinds of simpler grammars tend to be pretty dry. It would be fun to use more programming language-like examples. And then you might also see what difficulties you run into with them (with their limitations).
  • by atonalfreerider on 12/22/22, 2:45 PM

    Please see my lisp parser: https://youtu.be/40ua8NRyrro