Urgent.News

What's breaking now, across thousands of outlets.

Tech

93% of paint splatters are valid Perl programs!

The Entropy of Syntax: An Analysis of Perl's Lexical Permissiveness The proposition that 93% of random paint splatters constitute valid Perl programs is a provocative study in the intersection of computability, language design, and extreme syntactic flexibility. This claim, originating from a presentation at SIGBOVIK 2019, challenges traditional notions of how programming languages delimit their…

The study titled "The Entropy of Syntax: An Analysis of Perl's Lexical Permissiveness" explores the intriguing claim that 93% of random paint splatters can be considered valid Perl programs. This provocative finding challenges conventional beliefs about programming language syntax and validation. In Perl, the language's design philosophy prioritizes flexibility, famously encapsulated by the adage "There's More Than One Way To Do It" (TMTOWTDI), allowing for a high degree of syntactic leniency.

Unlike languages that enforce strict grammar rules, Perl's parser is highly forgiving, enabling a vast range of input strings to be interpreted as valid code. This is achieved through Perl's unique approach to parsing, which attempts to construct a valid Abstract Syntax Tree from any sequence of tokens, provided basic requirements such as balanced blocks and quotes are met.

The analysis reveals that the high success rate of random strings being interpreted as valid Perl is due to the language's tolerant treatment of identifiers, symbols, and expressions. Even when random noise is introduced, the probability of these sequences aligning with Perl's grammar is significant enough to qualify them as valid scripts.

The phenomenon underscores a trade-off in language design between expressiveness and safety, highlighting Perl's focus on developer productivity and text processing capabilities.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in Tech

DIY Guide: Is Netdata Worth Self-Hosting on a Home Server? 3-Year Cost of Netdata Open Source vs Netdata Cloud vs Datadog

DIY Guide: Is Netdata Worth Self-Hosting on a Home Server? 3-Year Cost of Netdata Open Source vs Netdata Cloud vs Datadog Executive Summary The question of whether to self-host Netdata on a home…

  • Self-hosting Netdata costs less than $50 over three years.
  • Cloud-based solutions like Netdata Cloud incur recurring fees.
  • Open Source Netdata via Docker balances cost and performance best.

More from Thursday 12 November →