News for hackers. Stuff that matters.
Re:Perl Cannot Be Parsed: A Formal Proof (2008) by perlgeek on Sunday May 26, 2013 @05:42AM (#5770614)
Well, you can't parse perl without running parts of it.

You can't parse lisp without running reader macros.

You can't parse TeX without running parts of it.

You can't parse C without parsing header files. (Ok, that one is as bit different, because header files are just C code as well).

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by 0x0 on Sunday May 26, 2013 @05:54AM (#5770643)
C++ templates are turing complete, so I guess you can't parse C++ without "running" the templates either. http://stackoverflow.com/questions/189172/c-templates-turing...
Re:Perl Cannot Be Parsed: A Formal Proof (2008) by ay on Sunday May 26, 2013 @06:47AM (#5770762)
FWIW, the C preprocessor can be used to calculate PI as well:

http://chaos-pp.cvs.sourceforge.net/chaos-pp/order-pp/exampl...

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by kivikakk on Sunday May 26, 2013 @07:38AM (#5770839)
No. The fact that a feature is Turing complete doesn't make the language unparseable.

C is Turing complete, but you don't need to run the program to parse C. Likewise for parsing C++ templates.

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by 0x0 on Sunday May 26, 2013 @07:47AM (#5770860)
But is parsing C turing-complete?

Because that's what I took away from reading about C++ templates - the turing-completeness happens at the parsing/preprocessing stage, before the compiler's code generator even starts translating. Was I wrong? Wouldn't a smart IDE that resolves types (for example for tab completion or type hints), looking at the Factorial<N> thing, have to solve for the value for Factorial<4>?

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by kivikakk on Sunday May 26, 2013 @07:53AM (#5770868)
No. (You need parse all includes to know typedefs, but that's it.)

C++ is awkward for a different reason, but there's nothing unparseable about it. Resolving types for tab completion/hinting is getting closer to static analysis (at least, with C++ it is), but parsing is well and truly done by that stage.

There's nothing about template<4> that can't be parsed, and nothing about the templates or instantiations thereof causes the syntax to be interpreted differently; this is probably the requirement for a parser to be Turing complete.

Perl is actually unparseable without execution: you can modify the allowed syntax mid-parse, based on some condition known only at runtime. Nothing about a template argument (for example) in some call causes a later template definition to be interpreted according to different syntax rules.

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by ExpiredLink on Sunday May 26, 2013 @03:09PM (#5772079)
> C++ is awkward for a different reason, but there's nothing unparseable about it.

Some corner cases in C++ are ambiguous. Those are 'resolved' by guessing what may be more suitable in the current context.

Re:Perl Cannot Be Parsed: A Formal Proof (2008) by 0x0 on Sunday May 26, 2013 @08:01AM (#5770882)
Makes perfect sense, and I see they're not the same now. Thanks for the explanation! :)
Re:Perl Cannot Be Parsed: A Formal Proof (2008) by JulianMorrison on Sunday May 26, 2013 @08:04AM (#5770888)
But you can parse Go without running anything.
Re:Perl Cannot Be Parsed: A Formal Proof (2008) by gngeal on Sunday May 26, 2013 @03:13PM (#5772093)
You can parse any language without running anything if you do it in your head. But most of us run at least the parser to do that. :-)