Interview Question
SDETsCountry: India
Interview Type: Phone Interview
You are almost right Chris brackets matching are not regular.
They are (Non deterministic) Context Free at best.
And yea I give n take interviews fairly regularly.
Appeared for : 50+ , Taken : 600+. There were days where I used to take 10 interviews a day, and there are days where I used to appear for 3 full panel interview a day. It is a fun activity.
since everybody can do above, I will just write the prove :-)
- Chris October 19, 2016prove by induction: base case ''; '(' ')'
which class of grammair: you can write a BNF production like
programm = {expression}
expression = "(" expression ")" | "(" ")"
{prodcution} means n-times, where 0<=n
2nd prove, just write a dump parser like a LL1 or recursive descent
so it's at most a context free language, question is if its a regular grammar as well (finite automata) ... it's too long, but I think a regular automata can't parse it (not to be confused with modern regular expressions...) could somebone comment on the last please.