Hacker News new | past | comments | ask | show | jobs | submit login

You need a stack because you could have sub expressions that also have commas. You only get away with an FSM if your syntax doesn’t best anything.

So seeing “use FSM for parsing” will obviously raise lots of an eyes will CS people, especially compiler people.




A CSV file has sub expressions?

Even if it has commas in quotes, it's a comma seen in the state 'collecting text'. There is no need for anything more complicated than an FSM. Maybe there is in leetcode. One character of pushback is not a 'stack' unless you are answering a Google interviewer.


In computer science, parsing is distinguished from scanning via nesting. Or you can think of it as languages that you can recognize with FSMs (scanning) like regular expressions, and languages you can recognize with PDAs (parsing) like CFGs.

This would never come up in a Google interview and really only comes up in CS 101 (or whatever your program's first CS theory course is) when you study computational models , languages and automata for the first time. Anyone who doesn't go on to do compilers really doesn't care much about the distinction.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: