<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Pomsky | Pomsky Blog</title><description/><link>https://pomsky-lang.org/</link><language>en</language><item><title>Pomsky 0.12</title><link>https://pomsky-lang.org/blog/pomsky-0-12/</link><guid isPermaLink="true">https://pomsky-lang.org/blog/pomsky-0-12/</guid><description>I am happy to announce version 0.12 of Pomsky, the next level regular expression language! Pomsky makes it easier than ever to write correct and maintainable regular expressions. Pomsky expressions are transpiled to regexes and can be used with many regex engines.
This release comes packed with new features and improvements. Here are the highlights:


The RE2 flavor, used for Go&apos;s regexp package, is now supported
Intersection of character sets
Improved Unicode support with Script Extensions
A convenient pomsky test subcommand for running unit tests
Powerful optimizations for repetitions, character sets, and alternatives
New IDE capabilities for the VSCode extension
New installers, including an npm package

Continue reading

</description><pubDate>Mon, 10 Nov 2025 10:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I’m happy to announce version 0.12 of Pomsky, the next-level regular expression language! Pomsky makes writing correct and maintainable regular expressions a breeze. Pomsky expressions are converted into regexes, which can be used with many different regex engines.&lt;/p&gt;
&lt;p&gt;If you’re not familiar with Pomsky, &lt;a href=&quot;https://pomsky-lang.org/docs/get-started/quick-reference&quot;&gt;here is a quick summary&lt;/a&gt; of how it compares to regular expressions.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;whats-new&quot;&gt;What’s new?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;This release comes packed with new features and improvements. Here are the highlights:&lt;/p&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;a href=&quot;#re2-support&quot;&gt;RE2 flavor&lt;/a&gt;, used for Go’s &lt;code dir=&quot;auto&quot;&gt;regexp&lt;/code&gt; package, is now supported&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;#character-set-intersection&quot;&gt;Intersection&lt;/a&gt; of character sets&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Improved Unicode support with &lt;a href=&quot;#unicode-script-extensions&quot;&gt;Script Extensions&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A convenient &lt;a href=&quot;#test-subcommand&quot;&gt;pomsky test&lt;/a&gt; subcommand for running unit tests&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Powerful &lt;a href=&quot;#optimizations&quot;&gt;optimizations&lt;/a&gt; for repetitions, character sets, and alternatives&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;New &lt;a href=&quot;#editor-improvements&quot;&gt;IDE capabilities&lt;/a&gt; for the VSCode extension&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;New &lt;a href=&quot;#new-installers&quot;&gt;installers&lt;/a&gt;, including an npm package&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;You might have noticed that Pomsky has a new logo. I’ve also updated the website by switching from Hugo to &lt;a href=&quot;https://starlight.astro.build/&quot;&gt;Starlight&lt;/a&gt;, as the Hugo theme we were using was no longer being maintained.&lt;/p&gt;
&lt;p&gt;This release took longer than usual because of a few unplanned delays. The last version was released almost two years ago! I had planned to cut a release by the end of 2024, but sometimes things don’t go as planned. The wait is finally over, so let’s take a look at the most exciting new features in this release!&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;re2-support&quot;&gt;RE2 Support&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;RE2 is a fast regex engine from Google. Unlike backtracking regex engines such as PCRE2, it is based on finite automata, so it has better worst-case performance. Pomsky now offers a &lt;strong&gt;RE2 flavor&lt;/strong&gt;, which is also compatible with Go’s &lt;code dir=&quot;auto&quot;&gt;regexp&lt;/code&gt; package. Because the RE2 flavor doesn’t support advanced features such as lookbehind and backreferences, Pomsky produces an error when you try to use them:&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;&gt; &lt;/span&gt;&lt;span&gt;pomsky&lt;/span&gt; &lt;span&gt;-f&lt;/span&gt; &lt;span&gt;re2&lt;/span&gt; &lt;span&gt;&quot;&amp;#x3C;&amp;#x3C; &apos;test&apos;&quot;&lt;/span&gt;
&lt;span&gt;&lt;b&gt;error P0301&lt;/b&gt;&lt;/span&gt;(compat):
  &lt;span&gt;×&lt;/span&gt; Unsupported feature `lookahead/behind` in the `RE2` regex flavor
   ╭────
 1 │ &amp;#x3C;&amp;#x3C; &apos;test&apos;
   · &lt;span&gt;&lt;b&gt;────┬────
&lt;/b&gt;&lt;/span&gt;   ·     &lt;span&gt;&lt;b&gt;╰── error occurred here
&lt;/b&gt;&lt;/span&gt;   ╰────
&lt;/pre&gt;
&lt;p&gt;With RE2, Pomsky now supports 8 regex flavors, covering most mainstream programming languages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;PCRE&lt;/strong&gt; (PHP, R, Erlang, …)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;JavaScript&lt;/strong&gt; (TypeScript, Dart, …)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Java&lt;/strong&gt; (JVM languages)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Python&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;.NET&lt;/strong&gt; (C#)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ruby&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rust&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RE2&lt;/strong&gt; (Go)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;character-set-intersection&quot;&gt;Character Set Intersection&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Several regex engines&lt;sup&gt;&lt;a href=&quot;#user-content-fn-1&quot; id=&quot;user-content-fnref-1&quot; data-footnote-ref=&quot;&quot; aria-describedby=&quot;footnote-label&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; support intersecting character sets:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;\p{&lt;/span&gt;&lt;span&gt;Thai&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span&gt;\p{&lt;/span&gt;&lt;span&gt;Nd&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;The above matches a codepoint that is in the ‘Thai’ script &lt;em&gt;and&lt;/em&gt; in the ‘Nd’ (decimal number) category. Pomsky now has an &lt;code dir=&quot;auto&quot;&gt;&amp;#x26;&lt;/code&gt; operator to express this:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[Thai] &amp;#x26; [Nd]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Some regex engines also support &lt;em&gt;subtraction&lt;/em&gt;. Pomsky doesn’t offer this feature, but it can be easily emulated using negation:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[Thai] &amp;#x26; &lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;[Nd]   &lt;/span&gt;&lt;span&gt;# negating one character set subtracts it&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Note that not all flavors support intersection. However, if both character sets are negated, they are merged by applying &lt;a href=&quot;https://en.wikipedia.org/wiki/De_Morgan&amp;#x27;s_laws&quot;&gt;De Morgan’s first law&lt;/a&gt;:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;[Thai] &amp;#x26; &lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;[Nd]  &lt;/span&gt;&lt;span&gt;# is turned into...&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;[Thai Nd]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;unicode-script-extensions&quot;&gt;Unicode Script Extensions&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Most software has to be able to handle text in different languages and writing systems. This is why I’ve always considered good Unicode support to be one of Pomsky’s strongest features. For example, Pomsky polyfills &lt;code&gt;&lt;span&gt;\w&lt;/span&gt;&lt;/code&gt; in JavaScript, which is surprisingly not Unicode aware, even with the &lt;code dir=&quot;auto&quot;&gt;unicode&lt;/code&gt; flag enabled.&lt;/p&gt;
&lt;p&gt;Pomsky also makes it easy to match a code point in a particular Unicode script: For example, &lt;code&gt;&lt;span&gt;[Syriac]&lt;/span&gt;&lt;/code&gt; matches all Syriac characters – at least in theory. But Unicode scripts cannot overlap, so code points that would belong in multiple scripts are assigned to the &lt;code dir=&quot;auto&quot;&gt;Common&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;Inherited&lt;/code&gt; script instead.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.unicode.org/L2/L2011/11406-script-ext.html&quot;&gt;Script Extensions&lt;/a&gt; solve this problem, which Pomsky now supports:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# matches all codepoints with a Syriac script extension&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[scx&lt;/span&gt;&lt;span&gt;:Syriac&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Because code points can have multiple scripts in their ‘Script Extensions’ property, this is more accurate.&lt;/p&gt;
&lt;p&gt;Script Extensions are currently only supported in the PCRE, JavaScript and Rust flavors, but hopefully more regex engines will add support in the future.&lt;/p&gt;
&lt;p&gt;In addition to &lt;code dir=&quot;auto&quot;&gt;scx:&lt;/code&gt;, you can also use the &lt;code dir=&quot;auto&quot;&gt;gc:&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;sc:&lt;/code&gt;, and &lt;code dir=&quot;auto&quot;&gt;blk:&lt;/code&gt; prefixes to match a general category, script, or block. These prefixes are optional, but adding them might help with readability:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[Letter]     &lt;/span&gt;&lt;span&gt;# old&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[gc&lt;/span&gt;&lt;span&gt;:Letter&lt;/span&gt;&lt;span&gt;]  &lt;/span&gt;&lt;span&gt;# new&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[InBasic_Latin]   &lt;/span&gt;&lt;span&gt;# old&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[blk&lt;/span&gt;&lt;span&gt;:Basic_Latin&lt;/span&gt;&lt;span&gt;] &lt;/span&gt;&lt;span&gt;# new&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Note that the &lt;code dir=&quot;auto&quot;&gt;In&lt;/code&gt; prefix of Unicode blocks is omitted when using the &lt;code dir=&quot;auto&quot;&gt;blk:&lt;/code&gt; prefix. It is recommended to use &lt;code dir=&quot;auto&quot;&gt;blk:&lt;/code&gt; because we will deprecate the &lt;code dir=&quot;auto&quot;&gt;In&lt;/code&gt; prefix in the future.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;test-subcommand&quot;&gt;Test subcommand&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky 0.11 added the &lt;code dir=&quot;auto&quot;&gt;test&lt;/code&gt; construct and a &lt;code dir=&quot;auto&quot;&gt;--test&lt;/code&gt; flag to run unit tests during compilation. This was a big step towards making Pomsky expressions more correct and maintainable. However, there was no easy way to test all Pomsky expressions in a project during a CI workflow. This has now been addressed with the new &lt;code dir=&quot;auto&quot;&gt;pomsky test&lt;/code&gt; command:&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;&gt; &lt;/span&gt;&lt;span&gt;pomsky&lt;/span&gt; &lt;span&gt;test&lt;/span&gt; &lt;span&gt;--path&lt;/span&gt; &lt;span&gt;examples/&lt;/span&gt; &lt;span&gt;-e&lt;/span&gt; &lt;span&gt;pcre2&lt;/span&gt;
&lt;span&gt;&lt;b&gt;testing &lt;/b&gt;&lt;/span&gt;examples/modes.pomsky ... &lt;span&gt;&lt;b&gt;ok
&lt;span&gt;testing &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;examples/email.pomsky ... &lt;span&gt;&lt;b&gt;ok
&lt;span&gt;testing &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;examples/repetitions.pomsky ... &lt;span&gt;&lt;b&gt;ok
&lt;span&gt;testing &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;examples/version.pomsky ... &lt;span&gt;&lt;b&gt;ok
&lt;span&gt;testing &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;examples/special.pomsky ... &lt;span&gt;&lt;b&gt;ok
&lt;span&gt;testing &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;examples/groups.pomsky ... &lt;span&gt;&lt;b&gt;ok
&lt;span&gt;testing &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;examples/strings.pomsky ... &lt;span&gt;&lt;b&gt;ok
&lt;span&gt;testing &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;examples/capt_groups.pomsky ... &lt;span&gt;&lt;b&gt;ok&lt;/b&gt;

&lt;/span&gt;test result: &lt;span&gt;&lt;b&gt;ok&lt;/b&gt;&lt;/span&gt;, 8 files tested in 1.41ms
&lt;/pre&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;pomsky test&lt;/code&gt; recursively iterates through the given directory, taking &lt;code dir=&quot;auto&quot;&gt;.ignore&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;.gitignore&lt;/code&gt; files into account, and tests all files ending with &lt;code dir=&quot;auto&quot;&gt;.pomsky&lt;/code&gt;. If at least one file doesn’t compile or contains a failing test, the program exits with an error, so it’s easy to include it in your CI pipeline.&lt;/p&gt;
&lt;p&gt;Pomsky previously only supported &lt;code dir=&quot;auto&quot;&gt;pcre2&lt;/code&gt; for running tests. In this release, we added &lt;code dir=&quot;auto&quot;&gt;rust&lt;/code&gt; as another option. We want to add more regex engines for unit tests, but this is proving tricky, so it didn’t make it into this release.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;optimizations&quot;&gt;Optimizations&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky lets you to refactor parts of an expression into variables to improve readability and follow the &lt;a href=&quot;https://en.wikipedia.org/wiki/Don%27t_repeat_yourself&quot;&gt;DRY principle&lt;/a&gt;. For example:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; digit = [&lt;/span&gt;&lt;span&gt;&apos;0&apos;&lt;/span&gt;&lt;span&gt;-&lt;/span&gt;&lt;span&gt;&apos;9&apos;&lt;/span&gt;&lt;span&gt;];&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; hex_digit = digit | [&lt;/span&gt;&lt;span&gt;&apos;a&apos;&lt;/span&gt;&lt;span&gt;-&lt;/span&gt;&lt;span&gt;&apos;f&apos;&lt;/span&gt;&lt;span&gt;];&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;But this comes with a trade-off: Sometimes the produced regex is less efficient and slower in some regex engines. Optimizations help with this, so you can write readable, DRY code without worrying too much about performance.&lt;/p&gt;
&lt;p&gt;In this release, Pomsky gained some important optimizations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Character ranges are merged if they are adjacent or overlap. For instance, &lt;code&gt;&lt;span&gt;&apos;a&apos;&lt;/span&gt;&lt;span&gt; | [&lt;/span&gt;&lt;span&gt;&apos;b&apos;&lt;/span&gt;&lt;span&gt;-&lt;/span&gt;&lt;span&gt;&apos;d&apos;&lt;/span&gt;&lt;span&gt; &apos;c&apos;&lt;/span&gt;&lt;span&gt;-&lt;/span&gt;&lt;span&gt;&apos;f&apos;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/code&gt; becomes just &lt;code&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;a-f&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Alternations are merged if possible: &lt;code&gt;&lt;span&gt;&quot;case&quot;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&quot;char&quot;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&quot;const&quot;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&quot;continue&quot;&lt;/span&gt;&lt;/code&gt; compiles to &lt;code&gt;&lt;span&gt;c&lt;/span&gt;&lt;span&gt;(?:&lt;/span&gt;&lt;span&gt;ase&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;har&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;on&lt;/span&gt;&lt;span&gt;(?:&lt;/span&gt;&lt;span&gt;st&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;tinue&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Merging common prefixes can help performance in backtracking regex engines. Note that optimizations are applied &lt;em&gt;after resolving variables&lt;/em&gt;, which is important for the example above.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;editor-improvements&quot;&gt;Editor improvements&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A key feature of any computer language is its IDE integration. For this release, we’ve added a few new features to the VSCode extension, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to definition&lt;/li&gt;
&lt;li&gt;Find usages&lt;/li&gt;
&lt;li&gt;Rename variable&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There’s just one caveat: for these features to work, the file has to be syntactically valid. This is because these actions work on the &lt;em&gt;abstract syntax tree&lt;/em&gt; (AST), and we currently can’t get the AST if parsing fails.&lt;/p&gt;
&lt;p&gt;The next step is therefore to make the parser &lt;em&gt;recoverable&lt;/em&gt;, so that it can produce an AST even in the presence of syntax errors. This will also help to improve autocompletion, which currently doesn’t use the AST.&lt;/p&gt;
&lt;p&gt;We’ve also added inlay hints to show the index of unnamed capturing groups, meaning you no longer need to count them when writing a replacement pattern.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;new-installers&quot;&gt;New installers&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;For this release, we adopted the wonderful &lt;a href=&quot;https://axodotdev.github.io/cargo-dist/&quot;&gt;cargo-dist&lt;/a&gt; for distributing the &lt;code dir=&quot;auto&quot;&gt;pomsky&lt;/code&gt; binary, so we could provide more installation options: In addition to the Windows, Linux and macOS binaries, we now have&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Shell and PowerShell scripts to download and install Pomsky&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An npm package, so you can install Pomsky with&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;npm&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;install&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;-g&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@pomsky-lang/cli&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;or run it directly with&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;span&gt;&lt;/span&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;npx&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;@pomsky-lang/cli&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An msi for installing and uninstalling Pomsky on Windows&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As before, you can also get Pomsky from the AUR with &lt;code dir=&quot;auto&quot;&gt;yay -S pomsky-bin&lt;/code&gt;, from crates.io with &lt;code dir=&quot;auto&quot;&gt;cargo install pomsky-bin&lt;/code&gt;, or from Homebrew.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;breaking-change-fixing-hygiene&quot;&gt;Breaking change: Fixing hygiene&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky variables work much like &lt;em&gt;macros&lt;/em&gt; in Lisp and Rust: When Pomsky encounters a variable, it is substituted with its content. Variables are &lt;a href=&quot;https://en.wikipedia.org/wiki/Hygienic_macro&quot;&gt;hygienic&lt;/a&gt;, which means they are properly scoped when substituted.&lt;/p&gt;
&lt;p&gt;However, we discovered that &lt;a href=&quot;https://pomsky-lang.org/docs/language-tour/modifiers/&quot;&gt;modifiers&lt;/a&gt; are not hygienic. For example:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; variable = &lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;enable&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;lazy&lt;/span&gt;&lt;span&gt;; variable)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Is the repetition in line 1 lazy or not? In Pomsky 0.11, it was lazy, which is counterintuitive because the &lt;code&gt;&lt;span&gt;enable&lt;/span&gt;&lt;span&gt; lazy&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/code&gt; statement is not in scope where the repetition appears, only where the variable is used.&lt;/p&gt;
&lt;p&gt;Unfortunately, fixing this required a breaking change. We think that the impact will be minimal, but to be sure, please check if you are relying on this behavior anywhere.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;other-changes&quot;&gt;Other changes&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;See the full list of changes in the &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/blob/main/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;support-us&quot;&gt;Support us!&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;We have a lot of exciting plans to make Pomsky a success. To realize them, we need your help! But when I say ‘we’, that’s mostly just me, &lt;a href=&quot;https://github.com/Aloso&quot;&gt;@Aloso&lt;/a&gt;, working on Pomsky in my spare time. I’m looking for contributors to implement new features, tooling, and integrations. If you’d like to help (or have questions, or just want to chat), drop by our &lt;a href=&quot;https://discord.gg/uwap2uxMFp&quot;&gt;&lt;strong&gt;Discord channel&lt;/strong&gt;&lt;/a&gt;. Also, if you’re using Pomsky, I’d like to hear about it!&lt;/p&gt;
&lt;p&gt;Consider &lt;a href=&quot;https://github.com/sponsors/Aloso&quot;&gt;&lt;strong&gt;sponsoring me&lt;/strong&gt;&lt;/a&gt; to help making my open-source work financially sustainable. Thank you ❤️&lt;/p&gt;
&lt;section data-footnotes=&quot;&quot;&gt;
&lt;ol&gt;
&lt;li id=&quot;user-content-fn-1&quot;&gt;
&lt;p&gt;Character set intersection is supported in the JavaScript, Java, Ruby, and Rust flavors. Note that JavaScript requires the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicodeSets&quot;&gt;v flag&lt;/a&gt; for this. &lt;a href=&quot;#user-content-fnref-1&quot; data-footnote-backref=&quot;&quot; aria-label=&quot;Back to reference 1&quot;&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;</content:encoded></item><item><title>Pomsky 0.11</title><link>https://pomsky-lang.org/blog/pomsky-0-11/</link><guid isPermaLink="true">https://pomsky-lang.org/blog/pomsky-0-11/</guid><description>This release comes with some exciting new features:


Unit tests to make sure your Pomsky expressions are correct
Negation of variables makes code re-use easier
New word boundaries &amp;lt; and &amp;gt;, matching at the start and end of a word, respectively
Recursion to match recursive grammars in PCRE and Ruby
Much improved documentation

Continue reading

</description><pubDate>Thu, 09 Nov 2023 10:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img alt=&quot;Cover art: A vibrant orange gradient moving up and down in waves on a deep blue background&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; fetchpriority=&quot;auto&quot; width=&quot;2448&quot; height=&quot;1506&quot; src=&quot;https://pomsky-lang.org/_astro/_cover.BK1i8yNh_ZGAAgP.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;I am excited to announce version 0.11 of Pomsky, the next level regular expression language! Pomsky makes it easier than ever to write &lt;em&gt;correct&lt;/em&gt; and &lt;em&gt;maintainable&lt;/em&gt; regular expressions. Pomsky expressions are transpiled to regexes and can be used with many regex engines.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;whats-new&quot;&gt;What’s new?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;This release comes with some exciting new features:&lt;/p&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;#unit-tests&quot;&gt;Unit tests&lt;/a&gt; to make sure your Pomsky expressions are correct&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;#negating-all-the-things&quot;&gt;Negation of variables&lt;/a&gt; makes code re-use easier&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;New &lt;a href=&quot;#new-word-boundaries&quot;&gt;word boundaries&lt;/a&gt; &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;&gt;&lt;/code&gt;, matching at the start and end of a word, respectively&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;#recursion&quot;&gt;Recursion&lt;/a&gt; to match recursive grammars in PCRE and Ruby&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Much improved &lt;a href=&quot;#improved-docs&quot;&gt;documentation&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;If you’re unfamiliar with Pomsky, &lt;a href=&quot;https://pomsky-lang.org/docs/get-started/quick-reference&quot;&gt;here is a summary&lt;/a&gt; of how Pomsky compares to regexes.&lt;/p&gt;
&lt;p&gt;Let’s look at the most exciting new features in this release!&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;unit-tests&quot;&gt;Unit tests&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;If you have non-trivial regular expressions in your code base, tests are essential to prevent regressions when modifying them. The tests also serve as documentation by showing what strings the expressions should match. Pomsky now makes it easier than ever to test regular expressions:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;test&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;# unit tests go here!&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;match&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;0.11.0&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;match&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;2023.3.7&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;match&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;1.0.0-beta+exp.sha.5114f85&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;match&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;1.0.0-rc.2&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;# these are invalid:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;reject&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;1.0&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;reject&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;1.2.3.4&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;reject&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;1.7_01&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;reject&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;^1.7.1&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; num = [ascii_digit]&lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; ident = [ascii_alnum &lt;/span&gt;&lt;span&gt;&apos;-&apos;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; idents = ident (&lt;/span&gt;&lt;span&gt;&apos;.&apos;&lt;/span&gt;&lt;span&gt; ident)&lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# https://semver.org/&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;:major&lt;/span&gt;&lt;span&gt;(num) &lt;/span&gt;&lt;span&gt;&apos;.&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;:minor&lt;/span&gt;&lt;span&gt;(num) &lt;/span&gt;&lt;span&gt;&apos;.&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;:patch&lt;/span&gt;&lt;span&gt;(num)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;-&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;:prerelease&lt;/span&gt;&lt;span&gt;(idents))&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;+&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;:buildmeta&lt;/span&gt;&lt;span&gt;(idents))&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Unit tests can also compare capturing groups:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;test&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;match&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;1.0.0-beta+exp.sha.5114f85&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;as&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;major: &lt;/span&gt;&lt;span&gt;&apos;1&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;minor: &lt;/span&gt;&lt;span&gt;&apos;0&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;patch: &lt;/span&gt;&lt;span&gt;&apos;0&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;prerelease: &lt;/span&gt;&lt;span&gt;&apos;beta&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;buildmeta: &lt;/span&gt;&lt;span&gt;&apos;exp.sha.5114f85&apos;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;};&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;You can run tests with the &lt;code dir=&quot;auto&quot;&gt;--test&lt;/code&gt; option.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://marketplace.visualstudio.com/items?itemName=pomsky-lang.pomsky-vscode&quot;&gt;VS Code extension&lt;/a&gt; and the &lt;a href=&quot;https://playground.pomsky-lang.org/&quot;&gt;online playground&lt;/a&gt; were updated to execute the tests as you type, so you immediately see when a test fails – ideal for test-driven development. In VS Code this must be enabled with the &lt;code dir=&quot;auto&quot;&gt;pomsky.runTests&lt;/code&gt; setting.&lt;/p&gt;
&lt;p&gt;Note that for now, tests are always run with the PCRE2 regex engine (except in the online playground, which uses the browser’s regex engine). PCRE2 was chosen because it has the most features and is easy to statically link, but proper support for other regex engines is planned as well.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;negating-all-the-things&quot;&gt;Negating all the things&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;If you ever needed to negate a variable that refers to a character set, this is now possible:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; d = [digit &lt;/span&gt;&lt;span&gt;&apos;_&apos;&lt;/span&gt;&lt;span&gt;];&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;d &lt;/span&gt;&lt;span&gt;!&lt;/span&gt;&lt;span&gt;d   &lt;/span&gt;&lt;span&gt;# output: [\d_][^\d_]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Until now, Pomsky’s syntax allowed the &lt;code dir=&quot;auto&quot;&gt;!&lt;/code&gt; only in front of the tokens &lt;code dir=&quot;auto&quot;&gt;[&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;&amp;#x3C;&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;&gt;&gt;&lt;/code&gt;, and &lt;code dir=&quot;auto&quot;&gt;%&lt;/code&gt;. This restriction has now been lifted.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;new-word-boundaries&quot;&gt;New word boundaries&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Pomsky now supports &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;&gt;&lt;/code&gt; to match the start and end of a word, respectively. You could use the word boundary &lt;code dir=&quot;auto&quot;&gt;%&lt;/code&gt; for this, but &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;&gt;&lt;/code&gt; are more specialized since they can only match the start &lt;em&gt;or&lt;/em&gt; end of a word, but not both. It might not matter most of the time, but using &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;&gt;&lt;/code&gt; may be considered more idiomatic:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&amp;#x3C;&lt;/span&gt;&lt;span&gt;&apos;test&apos;&lt;/span&gt;&lt;span&gt;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;This matches the word “test”, but not in “detest” or “testament”.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;recursion&quot;&gt;Recursion&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;When targeting PCRE or Ruby, you can now use recursion. It is pretty straightforward:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;test&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;match&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;3+4*5&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;match&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;2+(4/(-2))*15&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# a nested mathematical expression&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&apos;-&apos;&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt; ([digit]&lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&apos;(&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;recursion&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;)&apos;&lt;/span&gt;&lt;span&gt;) ([&lt;/span&gt;&lt;span&gt;&apos;+-*/&apos;&lt;/span&gt;&lt;span&gt;] &lt;/span&gt;&lt;span&gt;recursion&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;This recursively matches the whole expression whenever the &lt;code dir=&quot;auto&quot;&gt;recursion&lt;/code&gt; keyword is encountered.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;improved-documentation&quot;&gt;Improved documentation&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;For this release, the web docs were overhauled.&lt;/p&gt;
&lt;p&gt;Until now, the only documentation was the language tour, so it tried to accommodate everyone. This didn’t work, as it was too advanced for beginners, too wordy for people already familiar in regular expressions, and too imprecise as a specification. The solution is to provide different materials for different people:
for&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A &lt;a href=&quot;https://pomsky-lang.org/docs/get-started/quick-reference/&quot;&gt;quick reference&lt;/a&gt; for people who already know regular expressions and just want to learn Pomsky’s syntax as quickly as possible&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;a href=&quot;https://pomsky-lang.org/docs/language-tour/strings/&quot;&gt;language tour&lt;/a&gt; for to beginners to learn the fundamentals&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A &lt;a href=&quot;https://pomsky-lang.org/docs/reference/grammar/&quot;&gt;complete reference&lt;/a&gt; to document everything precisely for contributors or users with a very specific question&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I hope you enjoy the new docs. I always appreciate feedback!&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;See the full list of changes in the &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/blob/v0.11/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;roadmap-update&quot;&gt;Roadmap update&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;As the year is coming to an end and most of the things I planned for 2023 are done, I am evaluating which issues I should tackle next. The following plan is quite ambitious, so let’s see how much I will manage to implement next year!&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;language-changes&quot;&gt;Language changes&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;There are many features waiting to be implemented: Modifiers (like &lt;code dir=&quot;auto&quot;&gt;ignore_case&lt;/code&gt;), intersection and subtraction of character sets, subroutine calls, conditionals, etc.&lt;/p&gt;
&lt;p&gt;Other than that, the biggest focus next year will be on optimizations, so you can write expressions however you want without worrying too much about performance. Pomsky should feel more like a high-level language that lets you focus on the “business logic” instead of regex engine internals.&lt;/p&gt;
&lt;p&gt;Another focus area will be diagnostics: Pomsky should detect when an expression has poor worst-case performance and could be vulnerable to ReDoS (regex denial-of-service) attacks. It should also detect more patterns that are illegal in the targeted regex engine, e.g. variable-length lookbehind in PCRE and Python.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;vs-code-improvements&quot;&gt;VS Code improvements&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;The VS Code extension is lacking some features one has come to expect from their IDE: Go to definition, renaming symbols, and finding usages.&lt;/p&gt;
&lt;p&gt;To implement these, we need to parse Pomsky into a syntax tree, which is challenging because the existing parser is written in Rust, but the language server is written in TypeScript. Instead of rewriting the parser in TypeScript, one possibility is to use tree-sitter, a parser framework designed for IDEs.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;tooling&quot;&gt;Tooling&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;To make migrating to Pomsky easier, I want to make a Regex to Pomsky converter. We also need a formatting tool (like &lt;em&gt;prettier&lt;/em&gt; or &lt;em&gt;rustfmt&lt;/em&gt;) for Pomsky. These tools will be integrated in the CLI, the VS Code extension, and the online playground.&lt;/p&gt;
&lt;p&gt;Writing the Regex to Pomsky converter will be particularly challenging, since it requires a configurable parser that can correctly parse all regex flavors supported by Pomsky.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;support-us&quot;&gt;Support us!&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky is a very small community, and most of the work is still done by me. To make the continued development of Pomsky sustainable, I am looking for contributors. There are lots of opportunities to help; you can drop by our &lt;a href=&quot;https://discord.gg/uwap2uxMFp&quot;&gt;&lt;strong&gt;Discord channel&lt;/strong&gt;&lt;/a&gt; if you need guidance.&lt;/p&gt;
&lt;p&gt;Also, consider &lt;a href=&quot;https://github.com/sponsors/Aloso&quot;&gt;&lt;strong&gt;sponsoring me&lt;/strong&gt;&lt;/a&gt; to support my open source work!&lt;/p&gt;</content:encoded></item><item><title>Pomsky 0.10 released with new tools</title><link>https://pomsky-lang.org/blog/pomsky-0-10/</link><guid isPermaLink="true">https://pomsky-lang.org/blog/pomsky-0-10/</guid><description>Just last week, Pomsky celebrated its first birthday! Today, I&apos;m announcing version 0.10, along with a VSCode extension and a JavaScript plugin. This allows you to write regular expressions with Pomsky, and include them as RegExp with a bundler like Vite or Webpack.

Continue reading

</description><pubDate>Wed, 22 Mar 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img alt=&quot;Cover art: A grown husky standing in the grass on a river bank, as if he is thinking about taking a swim. It is a beautiful, sunny day, and the husky looks happy as he is sticking out his tongue. His fur is black on the back and changes to light gray towards the legs. His face is mostly white, with a black forehead. His neck has white and dark parts.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; fetchpriority=&quot;auto&quot; width=&quot;1920&quot; height=&quot;1276&quot; src=&quot;https://pomsky-lang.org/_astro/_cover.DB95U9_D_Z22GfQH.jpg&quot;&gt;&lt;/p&gt;
&lt;p&gt;Just last week, Pomsky celebrated its first birthday! Today, I’m announcing version 0.10, along with a VSCode extension and a JavaScript plugin. This allows you to write regular expressions with Pomsky, and include them as &lt;code dir=&quot;auto&quot;&gt;RegExp&lt;/code&gt; with a bundler like &lt;a href=&quot;https://vitejs.dev/&quot;&gt;Vite&lt;/a&gt; or &lt;a href=&quot;https://webpack.js.org/&quot;&gt;Webpack&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-is-pomsky&quot;&gt;What is Pomsky?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky is a modern syntax for regular expressions, transpiled to regexes compatible with JavaScript, Java, PCRE, Rust, Ruby, Python, or .NET. It aims to be more readable, portable, and powerful than traditional regexes. The biggest difference is that Pomsky is whitespace-insensitive, and string literals are quoted. For example, the regex &lt;code&gt;&lt;span&gt;\[&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt;\]&lt;/span&gt;&lt;/code&gt; could be written as &lt;code&gt;&lt;span&gt;&apos;[&apos;&lt;/span&gt;&lt;span&gt; .&lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt; &apos;]&apos;&lt;/span&gt;&lt;/code&gt;. Here’s a larger example that shows Pomsky’s strengths:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# variables allow code re-use&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; octet = &lt;/span&gt;&lt;span&gt;range&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;0&apos;&lt;/span&gt;&lt;span&gt;-&lt;/span&gt;&lt;span&gt;&apos;255&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# ranges can match multi-digit numbers&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; subnetMask = &lt;/span&gt;&lt;span&gt;&apos;/&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;range&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;0&apos;&lt;/span&gt;&lt;span&gt;-&lt;/span&gt;&lt;span&gt;&apos;32&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# concise syntax for named capturing groups (ipv4, mask)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;:ipv4&lt;/span&gt;&lt;span&gt;(octet (&lt;/span&gt;&lt;span&gt;&apos;.&apos;&lt;/span&gt;&lt;span&gt; octet){&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;}) &lt;/span&gt;&lt;span&gt;:mask&lt;/span&gt;&lt;span&gt;(subnetMask)&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;This is transpiled to the following regex:&lt;/p&gt;
&lt;!-- TODO: Figure out why this code snippet breaks the &quot;reading time&quot; metric --&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;?&amp;#x3C;&lt;/span&gt;&lt;span&gt;ipv4&lt;/span&gt;&lt;span&gt;&gt;&lt;/span&gt;&lt;span&gt;(?:&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;0-9&lt;/span&gt;&lt;span&gt;]{&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;}|&lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;(?:[&lt;/span&gt;&lt;span&gt;0-4&lt;/span&gt;&lt;span&gt;][&lt;/span&gt;&lt;span&gt;0-9&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;5&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;0-5&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;|[&lt;/span&gt;&lt;span&gt;6-9&lt;/span&gt;&lt;span&gt;])&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;|[&lt;/span&gt;&lt;span&gt;3-9&lt;/span&gt;&lt;span&gt;][&lt;/span&gt;&lt;span&gt;0-9&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;)(?:\.(?:&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;0-9&lt;/span&gt;&lt;span&gt;]{&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;}|&lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;span&gt;(?:[&lt;/span&gt;&lt;span&gt;0-4&lt;/span&gt;&lt;span&gt;][&lt;/span&gt;&lt;span&gt;0-9&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;5&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;0-5&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;|[&lt;/span&gt;&lt;span&gt;6-9&lt;/span&gt;&lt;span&gt;])&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;|[&lt;/span&gt;&lt;span&gt;3-9&lt;/span&gt;&lt;span&gt;][&lt;/span&gt;&lt;span&gt;0-9&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;)){&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;})(&lt;/span&gt;&lt;span&gt;?&amp;#x3C;&lt;/span&gt;&lt;span&gt;mask&lt;/span&gt;&lt;span&gt;&gt;&lt;/span&gt;&lt;span&gt;/&lt;/span&gt;&lt;span&gt;(?:&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;|[&lt;/span&gt;&lt;span&gt;1-2&lt;/span&gt;&lt;span&gt;][&lt;/span&gt;&lt;span&gt;0-9&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;0-2&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;|[&lt;/span&gt;&lt;span&gt;4-9&lt;/span&gt;&lt;span&gt;]))&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;whats-new&quot;&gt;What’s new&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Version 0.10 includes a number of language changes and new tools.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;vscode-extension&quot;&gt;VSCode extension&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Pomsky now has a &lt;a href=&quot;https://marketplace.visualstudio.com/items?itemName=pomsky-lang.pomsky-vscode&quot;&gt;VSCode extension&lt;/a&gt;, with syntax highlighting, auto-completion, and diagnostics (errors and warnings). It also has a preview panel, which you can open with the icon in the top right corner or from the right-click menu:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;VSCode window showing a Pomsky file with the &amp;#x26;#x27;.pom&amp;#x26;#x27; extension on the left, and a panel with the compiled regular expression on the right. The panel has a toolbar with a dropdown to select a regex flavor. VSCode&amp;#x26;#x27;s blue toolbar at the bottom tells us that the expression was compiled in 0.07 ms, using Pomsky 0.10.0&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; fetchpriority=&quot;auto&quot; width=&quot;1606&quot; height=&quot;910&quot; src=&quot;https://pomsky-lang.org/_astro/pomsky-vscode.0FuwZ1Ua_Z23IhT8.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;To use the VSCode extension, you currently need to have Pomsky installed locally. You can download it &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/releases&quot;&gt;from the releases page&lt;/a&gt;. If you want to try Pomsky without installing anything, check out the &lt;a href=&quot;https://playground.pomsky-lang.org/&quot;&gt;playground&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;Note that we don’t have an official file extension yet. You can vote for one &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/issues/77&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;javascript-plugin&quot;&gt;JavaScript plugin&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Thanks to &lt;a href=&quot;https://github.com/Kyza&quot;&gt;@Kyza&lt;/a&gt;, we now have a &lt;a href=&quot;https://github.com/pomsky-lang/unplugin-pomsky&quot;&gt;JavaScript plugin&lt;/a&gt; that allows you to easily import Pomsky expressions in your JavaScript projects using Vite, Webpack, Rollup, ESBuild or ESM. Once you followed the &lt;a href=&quot;https://github.com/pomsky-lang/unplugin-pomsky#readme&quot;&gt;installation instructions&lt;/a&gt;, you can use it like this:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;import&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;ipv4&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;from&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;./ipv4.pom&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;isValidIpV4&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;ipv4&lt;/span&gt;&lt;span&gt;().&lt;/span&gt;&lt;span&gt;test&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;How does it work? The plugin looks for imports with the file extension &lt;code dir=&quot;auto&quot;&gt;.pom&lt;/code&gt; or &lt;code dir=&quot;auto&quot;&gt;.pomsky&lt;/code&gt; and transforms them to export a function that returns the corresponding &lt;code dir=&quot;auto&quot;&gt;RegExp&lt;/code&gt;. This is done at build time, so it doesn’t affect website performance. I would like to thank &lt;a href=&quot;https://github.com/Kyza&quot;&gt;@Kyza&lt;/a&gt; for creating this wonderful plugin.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;disabling-unicode&quot;&gt;Disabling Unicode&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;One annoying thing about regular expressions in JavaScript is that &lt;code&gt;&lt;span&gt;\w&lt;/span&gt;&lt;/code&gt; and &lt;code&gt;&lt;span&gt;\b&lt;/span&gt;&lt;/code&gt; do not respect Unicode, even if the &lt;code dir=&quot;auto&quot;&gt;u&lt;/code&gt; flag (short for &lt;code dir=&quot;auto&quot;&gt;unicode&lt;/code&gt;) is set! Pomsky polyfills Unicode support for &lt;code&gt;&lt;span&gt;[word]&lt;/span&gt;&lt;/code&gt;, but not for &lt;code&gt;&lt;span&gt;%&lt;/span&gt;&lt;/code&gt; (a word boundary) for several reasons&lt;sup&gt;&lt;a href=&quot;#user-content-fn-1&quot; id=&quot;user-content-fnref-1&quot; data-footnote-ref=&quot;&quot; aria-describedby=&quot;footnote-label&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;To address this issue, Pomsky now lets you opt out of Unicode support. Now word boundaries are forbidden in the JavaScript flavor, but can be used if you disable Unicode support:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;disable&lt;/span&gt;&lt;span&gt; unicode;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;%&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;Pomsky&apos;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;%&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;This makes sense when you know that your input contains only ASCII characters. It also has the advantage that some shorthands, such as &lt;code&gt;&lt;span&gt;[word]&lt;/span&gt;&lt;/code&gt;, can be optimized better: &lt;code&gt;&lt;span&gt;[word]&lt;/span&gt;&lt;/code&gt; normally matches over 800 Unicode ranges, but when Unicode is disabled, it’s just &lt;code dir=&quot;auto&quot;&gt;[a-zA-Z0-9_]&lt;/code&gt;, which is more performant.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;reserved-keywords&quot;&gt;Reserved keywords&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;U&lt;/code&gt; was reserved to make the syntax for codepoints (e.g. &lt;code dir=&quot;auto&quot;&gt;U+FF&lt;/code&gt;) unambiguous. Now codepoints can be parsed even if they contain spaces (e.g. &lt;code dir=&quot;auto&quot;&gt;U + FF&lt;/code&gt;), although this isn’t usually recommended.&lt;/p&gt;
&lt;p&gt;Also, &lt;code dir=&quot;auto&quot;&gt;test&lt;/code&gt; has been reserved as a keyword to support unit testing in the future. Pomsky will be able to run unit tests during compilation to make sure that the regex matches certain strings:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;test&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;match&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;127.0.0.1&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;match&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;80.255.255.254/24&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;reject&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;400.1.2.3&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# your Pomsky expression here...&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;These tests not only give you immediate feedback if the expression is incorrect, they also document the code so that a reader can see examples of what the expression does or does not match. Unit tests will probably land in Pomsky 0.11, but the syntax is not fully fleshed out yet. &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/issues/75#issuecomment-1461616716&quot;&gt;Let me know&lt;/a&gt; what you think!&lt;/p&gt;
&lt;p&gt;You can find the full list of changes in the &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/blob/main/CHANGELOG.md#0100---2023-03-21&quot;&gt;changelog&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;a-glimpse-into-the-crystal-ball&quot;&gt;A glimpse into the crystal ball&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;In January, I published my &lt;a href=&quot;https://pomsky-lang.org/blog/pomsky-0.9-and-our-roadmap/#roadmap&quot;&gt;roadmap&lt;/a&gt; for this year, and some things are already done! The VSCode extension is not feature complete, but it is already very useful. Most of the language improvements I envisioned in January have also been implemented. The testing infrastructure has also made progress: All regex flavors are now tested in CI and compiled in our fuzzer.&lt;/p&gt;
&lt;p&gt;As for the future, it can be hard to predict what will happen. For example, I didn’t expect someone to create a JavaScript plugin, which was a pleasant surprise! I also underestimated my own velocity, so some of the things I put in the “not planned” section could be completed this year.&lt;/p&gt;
&lt;p&gt;If there is something you would like to work on, any help is appreciated! Pomsky has some &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22&quot;&gt;good first issues&lt;/a&gt;. For example, if you’re a native English speaker, we could use your help to overhaul the documentation.&lt;/p&gt;
&lt;p&gt;If you like Pomsky, consider &lt;a href=&quot;https://github.com/sponsors/Aloso&quot;&gt;sponsoring me&lt;/a&gt;. You can also give Pomsky a &lt;a href=&quot;https://github.com/pomsky-lang/pomsky&quot;&gt;star&lt;/a&gt; and join our &lt;a href=&quot;https://discord.gg/uwap2uxMFp&quot;&gt;Discord server&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;br&gt;
Ludwig&lt;/p&gt;
&lt;section data-footnotes=&quot;&quot;&gt;
&lt;ol&gt;
&lt;li id=&quot;user-content-fn-1&quot;&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;[word]&lt;/code&gt; is polyfilled as &lt;code&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;\p{&lt;/span&gt;&lt;span&gt;Alphabetic&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;M&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Nd&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Pc&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/code&gt;. Word boundaries (&lt;code dir=&quot;auto&quot;&gt;%&lt;/code&gt;) aren’t polyfilled for two reasons: First, the produced regex would be very large: &lt;code&gt;&lt;span&gt;(?:(&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;&amp;#x26;lt;!&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;\p{&lt;/span&gt;&lt;span&gt;Alphabetic&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;M&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Nd&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Pc&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;])(&lt;/span&gt;&lt;span&gt;?=&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;\p{&lt;/span&gt;&lt;span&gt;Alphabetic&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;M&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Nd&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Pc&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;])|(&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt;&amp;#x26;lt;=&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;\p{&lt;/span&gt;&lt;span&gt;Alphabetic&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;M&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Nd&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Pc&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;])(&lt;/span&gt;&lt;span&gt;?!&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;\p{&lt;/span&gt;&lt;span&gt;Alphabetic&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;M&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Nd&lt;/span&gt;&lt;span&gt;}\p{&lt;/span&gt;&lt;span&gt;Pc&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span&gt;]))&lt;/span&gt;&lt;/code&gt; Secondly, the polyfill requires lookbehind, which isn’t universally supported. Notably, lookbehind doesn’t work in Safari. &lt;a href=&quot;#user-content-fnref-1&quot; data-footnote-backref=&quot;&quot; aria-label=&quot;Back to reference 1&quot;&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;</content:encoded></item><item><title>Pomsky 0.9 and our roadmap</title><link>https://pomsky-lang.org/blog/pomsky-0-9/</link><guid isPermaLink="true">https://pomsky-lang.org/blog/pomsky-0-9/</guid><description>With this release, we&apos;re celebrating 1000 stars on GitHub! This is an important milestone, so I would like to take this opportunity to thank everyone who has supported me along the way: My siblings who always cheer me up, my colleague who gave me legal advice, everyone from the Rust community who provided useful feedback to me, the people who sent me pull requests, reported bugs, proposed new features, or reported vulnerabilities, and DALL·E for designing our logo. Thank you!
Pomsky has a Discord server now. Stop by if you have a question, want to help, or just want to chat with the maintainers (currently only me) or other users!

Continue reading

</description><pubDate>Sun, 15 Jan 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img alt=&quot;A husky wearing orange sunglasses&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; fetchpriority=&quot;auto&quot; width=&quot;2250&quot; height=&quot;1500&quot; src=&quot;https://pomsky-lang.org/_astro/_cover.CtPPqkGj_JIwji.jpg&quot;&gt;&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-is-pomsky&quot;&gt;What is Pomsky?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky is a portable, modern syntax for regular expressions. It has powerful features, such as
variables, and a much more readable syntax. Check out the
&lt;a href=&quot;https://pomsky-lang.org/docs/language-tour/basics/&quot;&gt;language tour&lt;/a&gt; to quickly get familiar with
Pomsky, or the &lt;a href=&quot;https://pomsky-lang.org/docs/examples/&quot;&gt;examples&lt;/a&gt; to see some real Pomsky
expressions.&lt;/p&gt;
&lt;p&gt;Pomsky is &lt;em&gt;not&lt;/em&gt; a regex engine. Instead, a Pomsky expression is transpiled to a normal RegExp,
compatible with many RegExp engines, including JavaScript, Java, PCRE, Ruby, Python, Rust and .NET.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;whats-new&quot;&gt;What’s new&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;With this release, we’re celebrating 1000 stars on GitHub! This is an important milestone, so I would like to take this opportunity to thank everyone who has supported me along the way: My siblings who always cheer me up, my colleague who gave me legal advice, everyone from the Rust community who provided useful feedback to me, the people who sent me pull requests, reported bugs, proposed new features, or reported vulnerabilities, and &lt;a href=&quot;https://openai.com/dall-e-2/&quot;&gt;DALL·E&lt;/a&gt; for designing our logo. Thank you!&lt;/p&gt;
&lt;p&gt;Pomsky has a &lt;a href=&quot;https://discord.gg/uwap2uxMFp&quot;&gt;Discord server&lt;/a&gt; now. Stop by if you have a question, want to help, or just want to chat with the maintainers (currently only me) or other users!&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;This is a small release focusing on maintenance and fixing bugs. The only user-facing change is that warnings and errors now include a code, such as &lt;code dir=&quot;auto&quot;&gt;P0100&lt;/code&gt;. Ideally, the CLI should provide all the necessary information to fix the problem, but if you ever have to search for an error, this code might make it easier to find relevant results.&lt;/p&gt;
&lt;p&gt;The other new feature is that Pomsky can now return all output as JSON with the &lt;code dir=&quot;auto&quot;&gt;--json&lt;/code&gt; flag, which will be important for tools and IDE integrations. Someone is currently working on an IntelliJ plugin, which they plan to release in a few weeks. It already offers many nice features, and I’m excited to announce it once the initial version is ready! If you’re using VS Code or another editor, please be patient. In the meantime, you can always use the &lt;a href=&quot;https://playground.pomsky-lang.org/&quot;&gt;online playground&lt;/a&gt;, which offers syntax highlighting, auto-completion and inline diagnostics.&lt;/p&gt;
&lt;p&gt;If you want to contribute to Pomsky, we now have a &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/blob/main/CONTRIBUTING.md&quot;&gt;contributor’s guide&lt;/a&gt; to help you get off the ground. It includes an architectural overview and explains how Pomsky is tested. If something is missing, please reach out.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;more-testing-improvements&quot;&gt;More testing improvements&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Last release, &lt;a href=&quot;https://pomsky-lang.org/blog/pomsky-0.8-released/#testing-improvements-and-bugfixes&quot;&gt;I improved the test suite and fuzzer&lt;/a&gt; by compiling generated regexes to check if they are syntactically valid. This proved to be very effective and uncovered a bunch of bugs.&lt;/p&gt;
&lt;p&gt;But I only compiled regexes in the &lt;code dir=&quot;auto&quot;&gt;Rust&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;PCRE&lt;/code&gt; flavors, because Pomsky can easily include these regex engines as Rust crates. Testing other variants is more difficult, but I was determined to get it working. To be really confident that a regex is valid, you have to test it; reading the documentation on regex engines only gets you so far, and in many cases the documentation is not as detailed as I had hoped.&lt;/p&gt;
&lt;p&gt;How did I approach this problem? First, I wrote small JavaScript, Java and Python programs to compile a regex and return whether it is valid. Now all I had to do was run these programs from Rust. But here’s the problem: Starting a JavaScript program with Node.js takes about 100ms, but when fuzzing, I want to compile thousands of expressions per second. Starting a process every time I want to verify a regex is not feasible.&lt;/p&gt;
&lt;p&gt;My solution was to spawn long-running processes that communicate via stdin and stdout: Whenever the Node.js program receives an expression via stdin, it tries to compile it and writes either “success!” or the error message to stdout. For Java and Python, we do the same. This works surprisingly well, and is fast enough for our fuzzer. For Ruby, we don’t have to spawn a process: I realized that Ruby uses the Oniguruma library, which is also available as Rust crate. This only leaves &lt;code dir=&quot;auto&quot;&gt;.NET&lt;/code&gt;, which still isn’t sufficiently tested. I first have to figure out how to compile C# on Linux, and make it work in our GitHub action on Windows, Ubuntu and macOS.&lt;/p&gt;
&lt;p&gt;When I started fuzzing with regex testing for Java, JavaScript, Python, Ruby, Rust and PCRE, it took only a few seconds for the fuzzer to spit out the first error. In total, it found 12 bugs, 10 of which are fixed in this release. Fixing the other bugs will require more work.&lt;/p&gt;
&lt;p&gt;You can find the complete changelog &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/blob/v0.9/CHANGELOG.md#090---2023-01-14&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;roadmap&quot;&gt;Roadmap&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;It’s a misconception that the more work you pour into a project, the less there is to do. A project is not a to-do list where you can do one task after another until you reach the end. In reality, the amount of work never decreases: The more code you write, the more code you have to maintain. Furthermore, as Pomsky becomes more popular, there are more people requesting features for diverse use cases.&lt;/p&gt;
&lt;p&gt;Right now, my capacity for feature development is very limited, both by my amount of spare time and by my mental health. Unless more people step up to help, I have to make tough decisions about which tasks take priority.&lt;/p&gt;
&lt;p&gt;Here’s what I’m going to work on in the next months:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Testing&lt;/strong&gt;: I’m committed to invest more work into automated testing to eliminate bugs.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optimizations&lt;/strong&gt;: There are some low-hanging fruit to make Pomsky’s output smaller and more
efficient.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Language improvements&lt;/strong&gt;: I have a few ideas how to make Pomsky more expressive. I’m also
considering some breaking syntax changes to make Pomsky more ergonomic and consistent, but these
ideas are not fleshed out yet.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VS Code extension&lt;/strong&gt;: Considering the popularity of VS Code, this is a must. I hope I’ll be able
to re-use some code from the Pomsky playground for this.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following features are &lt;strong&gt;not&lt;/strong&gt; on my to-do list right now:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Regex to Pomsky converter&lt;/li&gt;
&lt;li&gt;Auto-formatter&lt;/li&gt;
&lt;li&gt;Linter&lt;/li&gt;
&lt;li&gt;Babel or Vite plugins&lt;/li&gt;
&lt;li&gt;Python bindings&lt;/li&gt;
&lt;li&gt;Adding more flavors&lt;/li&gt;
&lt;li&gt;Publishing the CLI on other platforms&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All of these features would be great, but I probably won’t have the time to implement them myself anytime soon. If you want to help, all contributions are welcome and appreciated! Just let me know what you want to work on 😉&lt;/p&gt;
&lt;p&gt;If you like Pomsky, consider &lt;a href=&quot;https://github.com/sponsors/Aloso&quot;&gt;sponsoring me&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;br&gt;
Ludwig&lt;/p&gt;</content:encoded></item><item><title>Pomsky 0.8 released</title><link>https://pomsky-lang.org/blog/pomsky-0-8/</link><guid isPermaLink="true">https://pomsky-lang.org/blog/pomsky-0-8/</guid><description>This release focuses on stability, but also brings a few new features:


Inline regexes landed, allowing you to use regex features not yet supported by Pomsky
Pomsky now supports the dot, matching any code point
An optimization pass that tries to make the generated regex smaller
Many bugs were fixed

Continue reading

</description><pubDate>Thu, 22 Dec 2022 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img alt=&quot;New Pomsky logo&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; fetchpriority=&quot;auto&quot; width=&quot;1500&quot; height=&quot;1000&quot; src=&quot;https://pomsky-lang.org/_astro/_cover.DDStv4Fo_1eaNo2.jpg&quot;&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The new logo: A pomeranian husky wearing orange glasses, created with the help of &lt;a href=&quot;https://openai.com/dall-e-2/&quot;&gt;DALL·E 2&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div&gt;&lt;h2 id=&quot;what-is-pomsky&quot;&gt;What is Pomsky?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky is a portable, modern syntax for regular expressions. It has powerful features, such as
variables, and a much more readable syntax. Check out the
&lt;a href=&quot;https://pomsky-lang.org/docs/language-tour/basics/&quot;&gt;language tour&lt;/a&gt; to quickly get familiar with
Pomsky, or the &lt;a href=&quot;https://pomsky-lang.org/docs/examples/&quot;&gt;examples&lt;/a&gt; to see some real Pomsky
expressions.&lt;/p&gt;
&lt;p&gt;Pomsky is &lt;em&gt;not&lt;/em&gt; a regex engine. Instead, a Pomsky expression is transpiled to a normal RegExp,
compatible with many RegExp engines, including JavaScript, Java, PCRE, Ruby, Python, Rust and .NET.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;announcement&quot;&gt;Announcement&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Hi! I’m Ludwig, and I created Pomsky in my spare time. I am pleased to announce that you can now &lt;a href=&quot;https://github.com/sponsors/Aloso&quot;&gt;sponsor me&lt;/a&gt; for my work! It’s been a lot of fun to develop Pomsky, but as Pomsky is being used by more and more people, I will need more time for maintenance and improving the developer experience. Donations will help me to invest the time needed. If you can spare a few bucks or convince your employer to sponsor me, that would go a long way to make Pomsky sustainable.&lt;/p&gt;
&lt;p&gt;All sponsors will receive monthly updates on what I am working on, as I want to be transparent about how your money is used. Find out more on &lt;a href=&quot;https://github.com/sponsors/Aloso&quot;&gt;my GitHub sponsors page&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;summary-of-the-changes&quot;&gt;Summary of the changes&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;This release focuses on stability, but also brings a few new features:&lt;/p&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;#inline-regexes&quot;&gt;Inline regexes&lt;/a&gt; landed, allowing you to use regex features not yet supported by Pomsky&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Pomsky now supports the &lt;a href=&quot;#the-dot&quot;&gt;dot&lt;/a&gt;, matching any code point&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An &lt;a href=&quot;#optimizations&quot;&gt;optimization pass&lt;/a&gt; that tries to make the generated regex smaller&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Many bugs were fixed&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;&lt;h2 id=&quot;inline-regexes&quot;&gt;Inline regexes&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Inline regexes are an escape hatch to include an arbitrary regex, at the cost of fewer compile-time guarantees. They are added to the output without any escaping; you could compare this to inline assembly in higher-level languages like C or Rust. Inline regexes allow you to produce hand-optimized code, or use regex features that aren’t properly supported yet. For example:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; recurse = &lt;/span&gt;&lt;span&gt;regex&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&apos;(?R)&apos;&lt;/span&gt;&lt;span&gt;;  &lt;/span&gt;&lt;span&gt;# inline regex for using recursion&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; number = &lt;/span&gt;&lt;span&gt;&apos;-&apos;&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;span&gt; [digit]&lt;/span&gt;&lt;span&gt;+&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; operator = &lt;/span&gt;&lt;span&gt;&apos;+&apos;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&apos;-&apos;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&apos;*&apos;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&apos;/&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;let&lt;/span&gt;&lt;span&gt; expr = number | &lt;/span&gt;&lt;span&gt;&apos;(&apos;&lt;/span&gt;&lt;span&gt; recurse &lt;/span&gt;&lt;span&gt;&apos;)&apos;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;expr (operator expr)&lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;span&gt;# matches an arbitrarily nested term&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Note that recursion using the &lt;code dir=&quot;auto&quot;&gt;(?R)&lt;/code&gt; syntax only works in the &lt;a href=&quot;https://pomsky-lang.org/docs/reference/comparison/#explanation-of-the-flavors&quot;&gt;PCRE flavor&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Inline regexes are very powerful, but use them sparingly: Pomsky doesn’t parse their content, so it cannot warn you from mistakes. Pomsky usually guarantees that the regexes it generates are valid, but this guarantee may not hold if you’re using inline regexes.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-dot&quot;&gt;The dot&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;You’re probably wondering: &lt;a href=&quot;https://www.regular-expressions.info/dot.html&quot;&gt;The dot&lt;/a&gt; is one of the most important regex features, so why was it missing until now? I have been hesitant to add it because it’s so easy to forget that the dot does not match line breaks by default. Also, the dot is not Unicode-aware in all regex variants, and all regex engines treat line breaks slightly differently. That’s why I initially didn’t include the dot, and recommended to use &lt;code dir=&quot;auto&quot;&gt;Codepoint&lt;/code&gt; (abbreviated as &lt;code dir=&quot;auto&quot;&gt;C&lt;/code&gt;) instead.&lt;/p&gt;
&lt;p&gt;However, &lt;code dir=&quot;auto&quot;&gt;Codepoint&lt;/code&gt; won’t work in ERE (POSIX-extended regular expressions), which we want to support eventually. Also, I decided that best practices such as avoiding the dot are best enforced by a linter rather than the compiler, so specific lints can be disabled when necessary. Pomsky doesn’t have a linter &lt;em&gt;yet&lt;/em&gt;, but it’s still on my todo list.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;optimizations&quot;&gt;Optimizations&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky now does an optimization pass right before code generation. Before, optimizations were intermingled with parsing and code generation, which led to some problems: Parsing wasn’t lossless (extra parentheses would get lost), and the code was hard to maintain and iterate on. The new optimization pass solves these problems while significantly improving the generated code in some cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Subsequent repetitions are now merged whenever possible. For example, &lt;code&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;x&apos;&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;9&lt;/span&gt;&lt;span&gt;})&lt;/span&gt;&lt;span&gt;?&lt;/span&gt;&lt;/code&gt; becomes &lt;code&gt;&lt;span&gt;x&lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;9&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Duplicated items in a character set are removed. For example, &lt;code&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;&apos;hello world&apos;&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/code&gt; becomes &lt;code&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;helo wrd&lt;/span&gt;&lt;span&gt;]&lt;/span&gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Empty groups like &lt;code&gt;&lt;span&gt;(() &lt;/span&gt;&lt;span&gt;&apos;&apos;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/code&gt; are removed, even when followed by a repetition.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;More optimizations are planned: For example, we want to make it possible to combine alternatives with a common prefix, like &lt;code&gt;&lt;span&gt;&apos;make&apos;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&apos;maple&apos;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&apos;maker&apos;&lt;/span&gt;&lt;/code&gt;. Ideally, this would produce the output &lt;code&gt;&lt;span&gt;ma&lt;/span&gt;&lt;span&gt;(?:&lt;/span&gt;&lt;span&gt;ker&lt;/span&gt;&lt;span&gt;??&lt;/span&gt;&lt;span&gt;|&lt;/span&gt;&lt;span&gt;ple&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/code&gt;, which is much faster in more mainstream&lt;sup&gt;&lt;a href=&quot;#user-content-fn-1&quot; id=&quot;user-content-fnref-1&quot; data-footnote-ref=&quot;&quot; aria-describedby=&quot;footnote-label&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; regex engines that use backtracking instead of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Deterministic_finite_automaton&quot;&gt;DFA&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;testing-improvements-and-bugfixes&quot;&gt;Testing improvements and bugfixes&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;For this release we improved our testing and fuzzing infrastructure. We have a test harness with several hundred hand-written test cases. For each test case, we check if compiling it produces the expected output, or fails with the expected error if the input is malformed. We also have a fuzzer, which generates test cases and systematically mutates them to discover new code paths. While the test harness verifies that the output is correct, the fuzzer can only verify that the program doesn’t crash, since we can’t manually check millions of generated test cases.&lt;/p&gt;
&lt;p&gt;So to increase our confidence in Pomsky’s correctness, we started to compile regexes produced by Pomksy with the respective regex engine. For now, we only do this in the Rust and PCRE flavors, but we plan to compile more regex flavors in the future. This still doesn’t guarantee that the output is correct, but at least it checks if the output is syntactically valid. With this change, the fuzzer was able to find a few bugs during code generation.&lt;/p&gt;
&lt;p&gt;We also started measuring test coverage and uploading it to &lt;a href=&quot;https://coveralls.io/github/pomsky-lang/pomsky?branch=main&quot;&gt;coveralls.io&lt;/a&gt;. Looking at the reports helped us identify parts that needed more tests, and improving our test coverage. Unfortunately, the data isn’t as reliable as we’d hoped: Coveralls highlights many struct definitions and enum variants as “untested”, which is inaccurate. Measuring test coverage is still a net win, just don’t read too much into the numbers 😉&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;auditable-binaries&quot;&gt;Auditable binaries&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The binaries &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/releases&quot;&gt;published on GitHub&lt;/a&gt; and the &lt;a href=&quot;https://aur.archlinux.org/packages/pomsky-bin&quot;&gt;AUR&lt;/a&gt; are now built with &lt;code dir=&quot;auto&quot;&gt;cargo audit&lt;/code&gt;, so we can be sure there are no known vulnerabilites when we publish a new version. Additionally, the list of dependencies is embedded in the binaries, so you can check with &lt;code dir=&quot;auto&quot;&gt;cargo audit bin &amp;#x3C;PATH_TO_BINARY&gt;&lt;/code&gt; if any vulnerabilities were found since then. &lt;a href=&quot;https://github.com/rustsec/rustsec&quot;&gt;cargo-audit&lt;/a&gt; is a tool that scans libraries for advisories reported in the &lt;a href=&quot;https://rustsec.org/&quot;&gt;rustsec advisory DB&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;cli-changes&quot;&gt;CLI changes&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;You can now disable all warnings with &lt;code dir=&quot;auto&quot;&gt;-W0&lt;/code&gt;, compatibility warnings with &lt;code dir=&quot;auto&quot;&gt;-Wcompat=0&lt;/code&gt;, and deprecation warnings with &lt;code dir=&quot;auto&quot;&gt;-Wdeprecated=0&lt;/code&gt;. Needless to say that doing this is discouraged, except in edge cases. Warnings exist for a reason!&lt;/p&gt;
&lt;p&gt;You can specify which features should be allowed with &lt;code dir=&quot;auto&quot;&gt;--allowed-features&lt;/code&gt;. For example, with &lt;code dir=&quot;auto&quot;&gt;--allowed-features boundaries,dot,lazy-mode,named-groups,ranges,references,variables&lt;/code&gt;, only the specified language features are available. Without this argument, all features can be used.&lt;/p&gt;
&lt;p&gt;The help messages have been extended. &lt;code dir=&quot;auto&quot;&gt;pomsky -h&lt;/code&gt; now gives a short summary, while &lt;code dir=&quot;auto&quot;&gt;pomsky --help&lt;/code&gt; provides more detailed information.&lt;/p&gt;
&lt;p&gt;You might remember that I replaced &lt;code dir=&quot;auto&quot;&gt;clap&lt;/code&gt; with a more lightweight argument parsing library. The new library we’re using doesn’t support help generation, so I wrote a macro to generate help messages that can contain formatting and color. It is general enough that I might publish it as a separate crate, stay tuned!&lt;/p&gt;
&lt;p&gt;Happy Hanukkah! Merry Christmas! Happy Holidays!&lt;/p&gt;
&lt;p&gt;Ludwig&lt;/p&gt;
&lt;section data-footnotes=&quot;&quot;&gt;
&lt;ol&gt;
&lt;li id=&quot;user-content-fn-1&quot;&gt;
&lt;p&gt;An earlier version of this post said that “traditional” regex engines use backtracking. That’s not quite correct; backtracking only became popular with Perl. All regex flavors supported by Pomsky use backtracking, except for Rust, which builds a lazy DFA. &lt;a href=&quot;#user-content-fnref-1&quot; data-footnote-backref=&quot;&quot; aria-label=&quot;Back to reference 1&quot;&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;</content:encoded></item><item><title>Pomsky 0.7 released</title><link>https://pomsky-lang.org/blog/pomsky-0-7/</link><guid isPermaLink="true">https://pomsky-lang.org/blog/pomsky-0-7/</guid><description>I just released Pomsky 0.7 with a new, much faster parser.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Pomsky is a portable, modern syntax for regular expressions. It has powerful features, such as variables, and a much more readable syntax. Check out the language tour to quickly get familiar with Pomsky, or the examples to see some real Pomsky expressions.

Continue reading

</description><pubDate>Sat, 10 Sep 2022 00:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;p&gt;I just released Pomsky 0.7 with a new, much faster parser.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img alt=&quot;Pomsky&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; fetchpriority=&quot;auto&quot; width=&quot;3373&quot; height=&quot;2398&quot; src=&quot;https://pomsky-lang.org/_astro/_pomsky.DcpuD0re_2keRzm.jpg&quot;&gt;&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-is-pomsky&quot;&gt;What is Pomsky?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky is a portable, modern syntax for regular expressions. It has powerful features, such as
variables, and a much more readable syntax. Check out the
&lt;a href=&quot;https://pomsky-lang.org/docs/language-tour/basics/&quot;&gt;language tour&lt;/a&gt; to quickly get familiar with
Pomsky, or the &lt;a href=&quot;https://pomsky-lang.org/docs/examples/&quot;&gt;examples&lt;/a&gt; to see some real Pomsky
expressions.&lt;/p&gt;
&lt;p&gt;Pomsky is &lt;em&gt;not&lt;/em&gt; a regex engine. Instead, a Pomsky expression is transpiled to a normal RegExp,
compatible with many RegExp engines, including JavaScript, Java, PCRE, Ruby, Python, Rust and .NET.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;summary-of-the-changes&quot;&gt;Summary of the changes&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Because I didn’t publish a blog post when I released version 0.6, this post is a bit longer. Here’s
a summary:&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The parser was rewritten and is now much faster&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Pomsky is now published as WASM module to npm&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Some syntax additions make writing Pomsky expressions more fun&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Diagnostics were improved again. Most importantly, Pomsky now detects typos and suggests the
correct spelling!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The binary size has been significantly decreased&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;div&gt;&lt;h2 id=&quot;the-new-parser&quot;&gt;The new parser&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;The biggest change in this release is that the parser was rewritten from scratch. It previously used
&lt;a href=&quot;https://docs.rs/nom/latest/nom/&quot;&gt;nom&lt;/a&gt; parser combinators, but over time it became evident that
nom isn’t well suited for my use case. It made me jump through hoops to get decent error messages,
and performance was less than ideal. I considered optimizing other parts of the compiler, but it
turns out that parsing is the only performance bottleneck in Pomsky; all other compiler passes
take only a small fraction of the time required for parsing.&lt;/p&gt;
&lt;p&gt;The new parser doesn’t use any libraries. It has all the flexibility I need, and turned out to be
much faster. I haven’t even started to optimize it, and it’s already outperforming the previous
parser by &lt;strong&gt;up to 500%&lt;/strong&gt; according to my
&lt;a href=&quot;https://github.com/pomsky-lang/pomsky/tree/main/benchmark&quot;&gt;benchmarks&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So how did the code change? It became slightly longer, but in exchange, control flow is much more
explicit, so it’s easier to reason about the code.&lt;/p&gt;
&lt;p&gt;During the rewrite, I was glad that Pomsky has a variety of integration tests that cover both valid
and invalid inputs. Once the code compiled again, I ran the test suite to identify bugs. When all
the bugs I found were fixed and all 200 tests were green, I had much more confidence that my code
was correct.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-wasm-module&quot;&gt;The WASM module&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Pomsky is now &lt;a href=&quot;https://www.npmjs.com/package/pomsky-wasm&quot;&gt;published to npm&lt;/a&gt;. Getting it to work
turned out to be much more difficult than anticipated, but I finally found a good solution.&lt;/p&gt;
&lt;p&gt;The problem was that the WASM module, compiled with &lt;code dir=&quot;auto&quot;&gt;wasm-pack&lt;/code&gt;, didn’t work when imported with NPM
and served with Vite in development mode. It did work with Vite in release mode and with Webpack,
but my particular configuration seemed &lt;em&gt;jinxed&lt;/em&gt;. As I’m not ready to enter the world of pain that
is Webpack again, I spent lots of hours researching the problem.&lt;/p&gt;
&lt;br&gt;
&lt;blockquote&gt;
&lt;p&gt;What is Vite?&lt;/p&gt;
&lt;p&gt;In case you’re not familiar, Vite is a modern JavaScript bundler. It is much faster than Webpack,
requires less configuration, and many things (including TypeScript and SCSS support) work out of
the box.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;p&gt;I actually found two problems:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;wasm-pack&lt;/code&gt; emits JavaScript modules added with &lt;code dir=&quot;auto&quot;&gt;wasm_bindgen&lt;/code&gt; in a folder called &lt;code dir=&quot;auto&quot;&gt;snippets&lt;/code&gt;,
but this folder isn’t included in the &lt;code dir=&quot;auto&quot;&gt;package.json&lt;/code&gt; file, so it is ignored when publishing the
module to NPM.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Vite does some optimizations even in development mode. The optimized files are put in the
&lt;code dir=&quot;auto&quot;&gt;node_modules/.vite/deps&lt;/code&gt; folder. This broke the dynamic import of the WASM file, because a
script in this folder looked for the WASM file in the same folder, but the WASM file wasn’t
there.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The solution to the first problem was to manually add the &lt;code dir=&quot;auto&quot;&gt;snippets&lt;/code&gt; folder to &lt;code dir=&quot;auto&quot;&gt;package.json&lt;/code&gt; before
publishing. It’s not ideal having to edit an auto-generated file, but at least it works.&lt;/p&gt;
&lt;p&gt;The solution to the second problem was harder to find: Vite allows disabling optimizations for a
particular module with the &lt;code dir=&quot;auto&quot;&gt;optimizeDeps.exclude&lt;/code&gt; key.&lt;/p&gt;
&lt;p&gt;The NPM module is now used on the &lt;a href=&quot;https://playground.pomsky-lang.org/&quot;&gt;playground&lt;/a&gt;.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;syntax-changes&quot;&gt;Syntax changes&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;In the last two releases, there were a few syntax changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You can now use the &lt;code dir=&quot;auto&quot;&gt;^&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;$&lt;/code&gt; anchors instead of &lt;code dir=&quot;auto&quot;&gt;Start&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;End&lt;/code&gt;. These symbols are
well-known, not only because of regular expressions, but also because vim uses them.
This should make your Pomsky expressions more concise.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Pomsky now supports atomic groups!&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;# this is guaranteed to never backtrack&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;%&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;atomic&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&apos;integer&apos;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&apos;insert&apos;&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;&apos;in&apos;&lt;/span&gt;&lt;span&gt;) &lt;/span&gt;&lt;span&gt;%&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;Atomic groups can be more performant than regular groups. Note that atomic groups are only
available in the Java, PCRE, Ruby and .NET flavors.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Alternations now allow leading pipes, so you can format your expressions more beautifully:&lt;/p&gt;
&lt;div&gt;&lt;figure&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;pre&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;| &lt;/span&gt;&lt;span&gt;&apos;Lorem&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;| &lt;/span&gt;&lt;span&gt;:group&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;| &lt;/span&gt;&lt;span&gt;&apos;ipsum&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;| &lt;/span&gt;&lt;span&gt;&apos;dolor&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span&gt;| &lt;/span&gt;&lt;span&gt;&apos;sit&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;| &lt;/span&gt;&lt;span&gt;&apos;amet&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code dir=&quot;auto&quot;&gt;[codepoint]&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;[cp]&lt;/code&gt; syntax has been deprecated. Use the built-in &lt;code dir=&quot;auto&quot;&gt;Codepoint&lt;/code&gt;/&lt;code dir=&quot;auto&quot;&gt;C&lt;/code&gt;
variables instead. This is part of an effort to make the syntax more uniform and intuitive.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code dir=&quot;auto&quot;&gt;[.]&lt;/code&gt; has also been deprecated, but currently only issues a warning.&lt;/p&gt;
&lt;p&gt;I’m still undecided if this syntax should be removed entirely, or if the dot should be available,
even though its behavior can be surprising and &lt;code dir=&quot;auto&quot;&gt;Codepoint&lt;/code&gt; is usually better.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;improving-diagnostics&quot;&gt;Improving diagnostics&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Good error messages are dear to my heart. The last two releases had several improvements to
diagnostics that I want to highlight here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Pomsky now detects typos&lt;/strong&gt;. When you misspell a character class, variable name or capturing
group, Pomsky will suggest the correct spelling.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Many regex syntax diagnostics were added. Pomsky now recognizes most regex syntax and suggests
the equivalent Pomsky syntax.&lt;/p&gt;
&lt;p&gt;For example, trying to compile &lt;code dir=&quot;auto&quot;&gt;(?&amp;#x3C;grp&gt; &quot;test&quot;)&lt;/code&gt; will produce an error with this help message:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Named capturing groups use the &lt;code dir=&quot;auto&quot;&gt;:name(...)&lt;/code&gt; syntax. Try &lt;code dir=&quot;auto&quot;&gt;:grp(...)&lt;/code&gt; instead&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Pomsky is now able to report multiple errors at once. More changes to the parser are required
to make use of this effectively, but in some places it already works.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;h2 id=&quot;reducing-the-binary-size&quot;&gt;Reducing the binary size&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;I put some work into reducing the binary size. The first step was to strip debug symbols. I
previously didn’t strip them because I wanted to have useful backtraces in case of a panic. However,
I’m now confident enough in Pomsky’s stability that I think we don’t need them. And if you find a
panic, it should be reproducible with the same input.&lt;/p&gt;
&lt;p&gt;Stripping the binary decreased the CLI’s binary size on Linux from &lt;strong&gt;3.24 MiB&lt;/strong&gt; to &lt;strong&gt;1.39 MiB&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The parser rewrite had little impact on the CLI’s binary size: It reduced the binary size from
1.39 MiB to &lt;strong&gt;1.34 MiB&lt;/strong&gt;. However, the impact was more significant for the WASM module: It went
from &lt;strong&gt;224 KiB&lt;/strong&gt; to &lt;strong&gt;177 KiB&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The next step was to replace the &lt;code dir=&quot;auto&quot;&gt;clap&lt;/code&gt; crate with the much smaller &lt;code dir=&quot;auto&quot;&gt;lexopt&lt;/code&gt;. This reduced the CLI’s
binary size from 1.34 MiB to &lt;strong&gt;894 KiB&lt;/strong&gt;. Now that here isn’t any low-hanging fruit left, I’m
satisfied with the result.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;That’s it for today!&lt;/p&gt;
&lt;p&gt;Cheers,&lt;br&gt;
Ludwig&lt;/p&gt;</content:encoded></item><item><title>Introducing: Pomsky (formerly Rulex)</title><link>https://pomsky-lang.org/blog/introducing-pomsky/</link><guid isPermaLink="true">https://pomsky-lang.org/blog/introducing-pomsky/</guid><description>This year in February, I started a new project, which I named Rulex: A language that is transpiled to regular expressions. A month later, I released the first version of Rulex.
A lot has happened since then, so I wanted to give an update. First, the summary:


Rulex got noticed: It trended on Hacker News and now has over 700 stars on GitHub 🚀
I published my first two security advisories for Rulex on GitHub
I was forced to rename Rulex to Pomsky, because a lawyer claimed that my project
violates a registered trademark
Pomsky now has a website with a feature-rich online playground
Pomsky is still in an alpha stage, but it has seen many new features, improvements and
bugfixes since its first release.
If you&apos;re using Pomsky, or want to use it, I&apos;d like to hear from you!

Continue reading

</description><pubDate>Mon, 04 Jul 2022 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This year in February, I started a new project, which I named &lt;em&gt;Rulex&lt;/em&gt;: A language that is transpiled
to regular expressions. A month later, I released the first version of Rulex.&lt;/p&gt;
&lt;p&gt;A lot has happened since then, so I wanted to give an update. First, the summary:&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Rulex got noticed: It trended on Hacker News and now has over 700 stars on GitHub 🚀&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I published my first two security advisories for Rulex on GitHub&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I was forced to rename Rulex to &lt;strong&gt;Pomsky&lt;/strong&gt;, because a lawyer claimed that my project
violates a registered trademark&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Pomsky now has a website with a feature-rich online playground&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Pomsky is still in an alpha stage, but it has seen many new features, improvements and
bugfixes since its first release.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you’re using Pomsky, or want to use it, I’d like to hear from you!&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;div&gt;&lt;h2 id=&quot;what-is-pomsky-all-about&quot;&gt;What is Pomsky all about?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Regular expressions are a very widespread language; it has implementations in just about every programming language. They’re also very powerful and can come in handy in a variety of situations. Yet, many people dread writing them. Furthermore, decyphering a regex beyond a certain length and complexity is very difficult due to its dense and ambiguous syntax.&lt;/p&gt;
&lt;p&gt;Pomsky attempts to solve all the issues that regexes suffer from. Writing Pomsky expressions should be fun and not turn into a maintenance burden. I’ll explain how Pomsky achieves that, but note that Pomsky is &lt;em&gt;not&lt;/em&gt; a regex engine. Pomsky is just an alternative syntax that you can use with your regex engine of choice. This has the advantage that Pomsky can be used with all the existing programming languages and APIs that use regexes.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;free-spacing-mode&quot;&gt;Free-spacing mode&lt;/h3&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;If you want to see what Pomsky looks like, I encourage you to check out the examples on the &lt;a href=&quot;https://pomsky-lang.org/#examples&quot;&gt;home page&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The biggest problem with regular expressions is that you have to write everything in a single line without any white space. However, some regex engines have a free-spacing mode, enabled with &lt;code dir=&quot;auto&quot;&gt;(?x)&lt;/code&gt;. In free-spacing mode, spaces and line breaks are ignored, and you can add comments. This is really helpful to make regexes more readable.&lt;/p&gt;
&lt;p&gt;Pomsky goes one step further: In Pomsky, free-spacing is the default, and it’s supported for all regex engines, even JavaScript.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;no-backslash-escapes&quot;&gt;No backslash escapes&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;In theory, the syntax of regexes is quite simple. However, there is one thing that regularly trips people up: There’s a myriad of characters that need to be escaped, and forgetting to escape a character leads to subtle bugs. That’s why Pomsky doesn’t have character escapes. Instead, strings are written in quotes, and you can decide if you prefer double or single quotes.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;compatibility-and-unicode-support&quot;&gt;Compatibility and Unicode support&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Even though regex engines such as Java, PCRE or EcmaScript use a similar syntax, there are enough differences that writing portable regexes is difficult. If you want to use the same regex in different engines, you can’t use any of the more advanced features, such as named backreferences or lookbehind, because they either aren’t universally supported, or their behavior or syntax differs slightly between engines.&lt;/p&gt;
&lt;p&gt;Pomsky can’t solve this problem entirely. For example, when a regex engine doesn’t support lookbehind, there’s nothing we can do about it. However, Pomsky is able to polyfill some features, so they can be used in regex engines where they aren’t natively supported. For example, Pomsky polyfills named backreferences and proper Unicode support in JavaScript. When using an unsupported feature that Pomsky can’t polyfill, it will show an error message, so you don’t waste time trying it out.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;a-modern-reimagined-syntax&quot;&gt;A modern, reimagined syntax&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;Over the years, a lot of features have been added to regular expressions since they were invented in 1951. However, syntax has been limited by the characters that hold a special meaning in regexes: &lt;code dir=&quot;auto&quot;&gt;.+*?^$()[]{}|\&lt;/code&gt;. So it’s no surprise that many syntax constructs start with a backslash or with &lt;code dir=&quot;auto&quot;&gt;(?&lt;/code&gt;. For example, in PCRE, named backreferences use the syntax &lt;code dir=&quot;auto&quot;&gt;\k&amp;#x3C;name&gt;&lt;/code&gt;, and comments look like &lt;code dir=&quot;auto&quot;&gt;(?# comment)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Pomsky’s syntax is designed with newer features in mind. Furthermore, Pomsky prefers keywords over sigils except for the most commonly used constructs. This makes the syntax much easier to read.&lt;/p&gt;
&lt;div&gt;&lt;h3 id=&quot;variables&quot;&gt;Variables&lt;/h3&gt;&lt;/div&gt;
&lt;p&gt;In Pomsky, you can assign part of an expression to a variable and re-use it as often as you want. This can make more complex expressions much simpler. You can follow the best practice “don’t repeat yourself” (DRY), and document your code in the process by using descriptive variable names.&lt;/p&gt;
&lt;p&gt;There is just one limitation: Variables can’t recursively reference themselves. That would cause an infinite loop, since variables are inlined by Pomsky, therefore it is forbidden.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;pomskys-growth-in-popularity&quot;&gt;Pomsky’s growth in popularity&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;After Rulex was &lt;a href=&quot;https://news.ycombinator.com/item?id=31690878&quot;&gt;posted on Hacker News&lt;/a&gt;, it got 200 new stars on GitHub on a single day. Since then, there’s been steady growth, and now it has over 700 stars.&lt;/p&gt;
&lt;p&gt;This was really useful for me, because I received hundreds of comments on Reddit and Hacker News by people criticizing, praising and showing alternatives for Rulex. I couldn’t respond to all of them, but reading them gave me a better idea of what people want. It was very encouraging to see other people defending my project against critics. I was also positively surprised that the discussion was quite civil and productive 🙂&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;my-first-security-advisories&quot;&gt;My first security advisories&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;A consequence of the growing popularity was that people started trying out Rulex, and &lt;a href=&quot;https://github.com/evanrichter/&quot;&gt;someone&lt;/a&gt; even set up fuzzing for it. In case you’re unfamiliar with the concept: A fuzzer is a test harness that tests a program by feeding it with random input, and then systematically altering the input to explore different code paths.&lt;/p&gt;
&lt;p&gt;It didn’t take long before the fuzzer found a panic, which is a (usually unrecoverable) error in Rust. After a bit more time, it found another panic and a stack overflow.&lt;/p&gt;
&lt;p&gt;After the issues were fixed and the fuzzer had run for hours without bringing up any more panics, I published a patch and disclosed two &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/security/advisories?state=published&quot;&gt;security advisories&lt;/a&gt; a few days later. These have “low severity”, because there’s little chance that they could be exploited. An exploit would have required that a web service accepted and parsed untrusted rulex expressions, which is &lt;em&gt;strongly discouraged&lt;/em&gt; by the way!&lt;/p&gt;
&lt;p&gt;The good thing is that we are now much more confident in the correctness of the parser. After this incident, the integration test suite has also been improved and extended.&lt;/p&gt;
&lt;p&gt;I want to thank &lt;a href=&quot;https://github.com/evanrichter/&quot;&gt;Evan Richter&lt;/a&gt; for setting up the fuzzer, disclosing the panics to me, and guiding me through the security advisory process.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;renaming-rulex&quot;&gt;Renaming Rulex&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;https://pomsky-lang.org/_astro/_pomsky.BPlDjGyX_Z23d4L5.jpg&quot; alt=&quot;Pomsky&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; fetchpriority=&quot;auto&quot; width=&quot;1024&quot; height=&quot;675&quot;&gt;&lt;/p&gt;
&lt;p&gt;As announced in &lt;a href=&quot;https://pomsky-lang.org/blog/renaming-rulex/&quot;&gt;my previous post&lt;/a&gt;, I had to rename Rulex to Pomsky. Read the announcement to find out the reasons, and why I chose the name “Pomsky”.&lt;/p&gt;
&lt;p&gt;If you use the &lt;code dir=&quot;auto&quot;&gt;rulex&lt;/code&gt; library or the &lt;code dir=&quot;auto&quot;&gt;rulex-macro&lt;/code&gt; crate, instructions for migrating are in the &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/blob/main/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note that the new AUR package hasn’t been released yet.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-website&quot;&gt;The website&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Considerable work went into improving the landing page, the documentation and the online playground of Pomsky. When I published the first version, there was an &lt;a href=&quot;https://github.com/rust-lang/mdBook&quot;&gt;mdbook&lt;/a&gt; with documentation. I really like mdbook for its ease of use, but I wanted more customizability, so I rewrote it with Hugo.&lt;/p&gt;
&lt;p&gt;The first version of the playground has also since been rewritten in React. It now uses &lt;a href=&quot;https://microsoft.github.io/monaco-editor/&quot;&gt;monaco editor&lt;/a&gt;, the editor powering VS Code, and supports several IDE features such as intelligent autocompletions and highlighting errors while typing. The playground also supports matching on text now, similar to &lt;a href=&quot;https://regexr.com/&quot;&gt;regexr&lt;/a&gt;, although not as advanced.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;where-we-are-now&quot;&gt;Where we are now&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Although Pomsky is still in an alpha stage, I want to highlight how far we’ve come. In version 0.3.0, two significant new features were introduced: &lt;a href=&quot;https://pomsky-lang.org/docs/language-tour/variables/&quot;&gt;Variables&lt;/a&gt; and &lt;a href=&quot;https://pomsky-lang.org/docs/language-tour/ranges/&quot;&gt;number ranges&lt;/a&gt;. These make Pomsky much more expressive than regular expressions. 0.3.0 also featured &lt;a href=&quot;https://pomsky-lang.org/docs/language-tour/references/&quot;&gt;relative references&lt;/a&gt;. Version 0.4.2 deprecated &lt;code dir=&quot;auto&quot;&gt;&amp;#x3C;%&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;%&gt;&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;[codepoint]&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;[cp]&lt;/code&gt; and &lt;code dir=&quot;auto&quot;&gt;[.]&lt;/code&gt; in favor of &lt;a href=&quot;https://pomsky-lang.org/docs/reference/constructs/variables/#built-in-variables&quot;&gt;built-in variables&lt;/a&gt;. Several versions also contained bug fixes and improved diagnostics.&lt;/p&gt;
&lt;p&gt;These diagnostics are something I’m really proud of:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://pomsky-lang.org/_astro/_diagnostics.nStZJUQV_ZcONgz.png&quot; alt=&quot;$ pomsky &amp;#x27;(&amp;#x22;Hello world&amp;#x22;) \1&amp;#x27;
Error:
× Backslash escapes are not supported
╭────
1 │ (&amp;#x22;Hello world&amp;#x22;) \1
·                 ─┬
·                  ╰── error occurred here
╰────
help: Replace \1 with ::1&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; fetchpriority=&quot;auto&quot; width=&quot;1006&quot; height=&quot;440&quot;&gt;&lt;/p&gt;
&lt;p&gt;What’s so special about this? Pomsky recogizes a lot of regular expression syntax, so it can show a more useful &lt;code dir=&quot;auto&quot;&gt;help&lt;/code&gt; message.&lt;/p&gt;
&lt;p&gt;But I think we can do better: I’m going to write a tool that converts any regex to a Pomsky expression. This will make it much easier to migrate to Pomsky.&lt;/p&gt;
&lt;p&gt;I also have plans to publish a VS Code extension and a babel plugin, to make the development process with Pomsky even smoother. If you have any more suggestions, I’d like to hear them!&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;users-where-are-you&quot;&gt;Users, where are you?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;To inform decisions about the future development of rulex, it would be useful to know how many people are using Pomsky, and &lt;em&gt;how&lt;/em&gt;. I would also like to know from people who want to use Pomsky, but can’t for some reason.&lt;/p&gt;
&lt;p&gt;However, we currently don’t have that data. Therefore, I’m asking you, if you’re using Pomsky, or would like to, please write a comment in &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/issues/42&quot;&gt;this issue&lt;/a&gt;, or &lt;a href=&quot;mailto:feedback@pomsky-lang.org&quot;&gt;send me an email&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;br&gt;
Ludwig&lt;/p&gt;</content:encoded></item><item><title>Renaming Rulex</title><link>https://pomsky-lang.org/blog/renaming-rulex/</link><guid isPermaLink="true">https://pomsky-lang.org/blog/renaming-rulex/</guid><description>Hello world. This is not what I expected my first blog post to be, but here we are.
I was recently contacted by a lawyer on behalf of Rulex, Inc., who claimed that I&apos;m not allowed to use the name &quot;Rulex&quot; for my project, because they own a registered trademark for the name. This is disappointing because coming up with a good name that isn&apos;t already used is hard. Furthermore, their trademark is registered for software using Artificial Intelligence, so I&apos;m pretty sure that I&apos;m allowed to use it for a project that is unrelated to AI.

Continue reading

</description><pubDate>Fri, 01 Jul 2022 13:06:32 GMT</pubDate><content:encoded>&lt;p&gt;Hello world. This is not what I expected my first blog post to be, but here we are.&lt;/p&gt;
&lt;p&gt;I was recently contacted by a lawyer on behalf of Rulex, Inc., who claimed that I’m not allowed to
use the name “Rulex” for my project, because they own a registered trademark for the name. This is
disappointing because coming up with a good name that isn’t already used is hard. Furthermore,
their trademark is registered for software using Artificial Intelligence, so I’m pretty sure that
I’m allowed to use it for a project that is unrelated to AI.&lt;/p&gt;
&lt;p&gt;However, I don’t want to risk a lawsuit, because that would entail a lot of work, time and stress.
Therefore, it is with a heavy heart that I have decided to comply with the demands of Rulex, Inc.
and rename my project.&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;what-is-the-new-name&quot;&gt;What is the new name?&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;img alt=&quot;Pomsky&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; fetchpriority=&quot;auto&quot; width=&quot;3386&quot; height=&quot;2250&quot; src=&quot;https://pomsky-lang.org/_astro/_renaming-rulex.D5tR5PSt_Z2hziNl.jpg&quot;&gt;&lt;/p&gt;
&lt;p&gt;While I was brainstorming new names, I was reminded of &lt;a href=&quot;https://pugjs.org/api/getting-started.html&quot;&gt;pug&lt;/a&gt;. For those who don’t know it or weren’t
aware, pug was once called jade. In 2016, they were &lt;a href=&quot;https://github.com/pugjs/pug/issues/2184&quot;&gt;forced to change the name&lt;/a&gt;, because
some company has a trademark for the word “jade” referring to software. This gave me the idea to
also name my project, like pug, after a dog breed.&lt;/p&gt;
&lt;p&gt;The breed I settled on is the &lt;strong&gt;Pomsky&lt;/strong&gt;, a hybrid of a Siberian Husky and a Pomeranian. I think
this is a great name for several reasons. First, it’s short, only 1 letter longer than rulex.
There is no company or registered trademark named “Pomsky”. And the best part, our project now has
a really cute mascot 😀&lt;/p&gt;
&lt;p&gt;It’s also nice that Pomsky rhymes with &lt;a href=&quot;https://en.wikipedia.org/wiki/Noam_Chomsky&quot;&gt;Noam Chomsky&lt;/a&gt;, a famous linguist. Chomsky
influenced the field of linguistics like no other, and he has also worked with formal languages and
formal grammars. He came up with &lt;a href=&quot;https://www.freecodecamp.org/news/exploring-the-linguistics-behind-regular-expressions-596fab41146/&quot;&gt;Chomsky’s hierarchy&lt;/a&gt;, which categorizes
formal languages by the strictness of their grammar:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Regular grammars&lt;/li&gt;
&lt;li&gt;Context-free grammars&lt;/li&gt;
&lt;li&gt;Context-sensitive grammars&lt;/li&gt;
&lt;li&gt;Unrestricted&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Regular grammars are the most strict, and can always be parsed with a regular expression. And this
makes Chomsky’s work relevant for rulex — errrr, Pomsky!&lt;/p&gt;
&lt;div&gt;&lt;h2 id=&quot;the-roadmap&quot;&gt;The roadmap&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;Renaming rulex to Pomsky is quite a bit of work, and can be &lt;a href=&quot;https://github.com/pomsky-lang/pomsky/issues/40&quot;&gt;tracked here&lt;/a&gt;. The
name appears in a lot of different places, and during the migration we have to be careful not to
break anyone’s workflow or invalidate the old website URLs. The &lt;code dir=&quot;auto&quot;&gt;rulex-rs.github.io&lt;/code&gt; subdomain will
redirect to the new website. Furthermore, crates on crates.io are immutable and can’t be renamed,
so we have to release new crates using the new name, and we have to add disclaimers to the existing
crates that users have to switch to the new ones.&lt;/p&gt;
&lt;p&gt;If you have questions about the renaming process, you can ask them in
&lt;a href=&quot;https://github.com/pomsky-lang/pomsky/issues/40&quot;&gt;this issue&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Have a great day!&lt;/p&gt;
&lt;p&gt;Cheers,&lt;br&gt;
Ludwig&lt;/p&gt;</content:encoded></item></channel></rss>