Hacker News new | past | comments | ask | show | jobs | submit login
C++ Parser in Forth? (groups.google.com)
48 points by pplonski86 on Jan 5, 2019 | hide | past | favorite | 12 comments



Somewhat related:

6 minute WTF video on the C++ grammar

https://www.youtube.com/watch?v=tsG95Y-C14k


Yeah this is a good one. I've been programming C++ for a long time and it does give you a sense of how hopeless this task is :)


Jesus christ I love being a scheme weenie.


Great video! But what sick and twisted mind would think of doing this? https://youtu.be/tsG95Y-C14k?t=277


The unholy union of all my favourite programming nightmares. I wish this adventurer luck.


I was toying around with a C++ parser in python (using the earley parser spark.py) a while back and it wasn't all that difficult, couple conflicts that can't be solved without knowing the type of something in the lexer which can be sorted out in later stages (methinks?) and (IIRC from looking at the code) a shift/reduce conflict in declarator-id, but all in all I got it to pass all the tests I found from some advanced compiler course.

Never went past getting it into a AST because I tend to find some other shiny thing to play with before I finish things but I'd imagine the implementation language wouldn't be a serious impediment...saying as someone never having written a single line of Forth.

--edit--

C++11 I should say since C++14 added things like >> conflict between the shift operator and nested templates that I didn't even get around to trying to solve.


C++ is a little like the English language: a bunch of different pieces gathered together over a period of time, new features added to replace/fix old. I like it.


It also dropped some letters (æ, þ) and pronouns (thou, thee). Most of what was added was vocabulary, to be comparable to C++ one would probably have to add all the Finnish cases, Japanese gendered language and all the Vietnamese accents.

And then have some people who mostly communicate by yodeling or Mongolian throat singing.


I like the comparison to steampunk: modern ideas bolted on to antique technology.


What? Did this item change url and title? Earlier it was an article about initialization in c++?


Are you sure you're not thinking about this?

https://news.ycombinator.com/item?id=18832311


That's what I thought this article was... Maybe I opened both of them, read the other one and closed it, then came back surprised to find this one.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: