Skip to content

Language Design and Theory of Computation

andychu edited this page Jan 26, 2017 · 25 revisions

Undecidable Parsing

Deciding whether to print "syntax error" shouldn't require simulating a Turing machine.

  • Parsing Bash is Undecidable
    • Bash, Perl, and Make can't be statically parsed because they interleave parsing and execution.
    • C++ can't be statically parsed because it has two Turing complete computation mechanisms -- the templates at compile times and normal code at runtime -- and parsing sits in between them.

Accidentally Turing Complete

Context-Free Grammars are not Powerful Enough in Practice

Humans are better than computers at parsing programming languages.

To-do: collect instances of people arguing for grammars . For tools, IDEs?

GLR: Pure Declarative Syntax Lost and Regained.

Langsec: this is a different issue.

TODO:

Sweet spot : Turing complete , linear time , and statically parse able

Lexing and Parsing should be Separate.

PEGs combine them, only for reasons of presentation.

Had this discussion twice: at work about GLR, and maybe about Gazelle. And on HN: https://news.ycombinator.com/item?id=13042835

Related Issues

  • Turing completeness vs. side effects/capabilities. Both of these are design issues and shouldn't be conflated.
  • Whether there is abstraction power like functions. I think Awk was Turing complete at first, but it didn't have functions. Related lobsters thread.
Clone this wiki locally