What programming languages are context-free?

前端 未结 9 975
萌比男神i
萌比男神i 2020-12-07 13:17

Or, to be a little more precise: which programming languages are defined by a context-free grammar?

From what I gather C++ is not context-free due to things like mac

9条回答
  •  借酒劲吻你
    2020-12-07 14:02

    Most of the modern programming languages are not context-free languages. As a proof, if I delve into the root of CFL its corresponding machine PDA can't process string matchings like {ww | w is a string}. So most programming languages require that.

    Example:

    int fa; // w
    fa=1; // ww as parser treat it like this
    

提交回复
热议问题