patternMinor
Why we use context-free grammar for parsing?
Viewed 0 times
whyfreegrammarforparsingcontextuse
Problem
Why we use context-free grammar for parsing? Why not regular expression and not context-sensitive grammar?
Solution
Because regular expressions are too weak and context-sensitive languages are too difficult to parse. More specifically, regular expressions can't specify that the brackets in your program match up; determining whether a string matches a context-sensitive language is PSPACE-complete (so probably takes exponential time).
Context
StackExchange Computer Science Q#37167, answer score: 7
Revisions (0)
No revisions yet.