mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-24 02:36:15 +00:00
55 lines
No EOL
4.7 KiB
HTML
55 lines
No EOL
4.7 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>DSL reference: a note on the complexity of Miller’s expression language — Miller 6.0.0-alpha documentation</title>
|
||
|
||
<link rel="stylesheet" href="_static/scrolls.css" type="text/css" />
|
||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||
<link rel="stylesheet" href="_static/print.css" type="text/css" />
|
||
|
||
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||
<script src="_static/jquery.js"></script>
|
||
<script src="_static/underscore.js"></script>
|
||
<script src="_static/doctools.js"></script>
|
||
<script src="_static/language_data.js"></script>
|
||
<script src="_static/theme_extras.js"></script>
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="next" title="Manpage" href="manpage.html" />
|
||
<link rel="prev" title="DSL reference: errors and transparency" href="reference-dsl-errors.html" />
|
||
</head><body>
|
||
<div id="content">
|
||
<div class="header">
|
||
<h1 class="heading"><a href="index.html"
|
||
title="back to the documentation overview"><span>DSL reference: a note on the complexity of Miller’s expression language</span></a></h1>
|
||
</div>
|
||
<div class="relnav" role="navigation" aria-label="related navigation">
|
||
<a href="reference-dsl-errors.html">« DSL reference: errors and transparency</a> |
|
||
<a href="#">DSL reference: a note on the complexity of Miller’s expression language</a>
|
||
| <a href="manpage.html">Manpage »</a>
|
||
</div>
|
||
<div id="contentwrapper">
|
||
<div role="main">
|
||
|
||
<div class="section" id="dsl-reference-a-note-on-the-complexity-of-miller-s-expression-language">
|
||
<h1>DSL reference: a note on the complexity of Miller’s expression language<a class="headerlink" href="#dsl-reference-a-note-on-the-complexity-of-miller-s-expression-language" title="Permalink to this headline">¶</a></h1>
|
||
<p>One of Miller’s strengths is its brevity: it’s much quicker – and less error-prone – to type <code class="docutils literal notranslate"><span class="pre">mlr</span> <span class="pre">stats1</span> <span class="pre">-a</span> <span class="pre">sum</span> <span class="pre">-f</span> <span class="pre">x,y</span> <span class="pre">-g</span> <span class="pre">a,b</span></code> than having to track summation variables as in <code class="docutils literal notranslate"><span class="pre">awk</span></code>, or using Miller’s out-of-stream variables. And the more language features Miller’s put-DSL has (for-loops, if-statements, nested control structures, user-defined functions, etc.) then the <em>less</em> powerful it begins to seem: because of the other programming-language features it <em>doesn’t</em> have (classes, exceptions, and so on).</p>
|
||
<p>When I was originally prototyping Miller in 2015, the decision I had was whether to hand-code in a low-level language like C or Rust or Go, with my own hand-rolled DSL, or whether to use a higher-level language (like Python or Lua or Nim) and let the <code class="docutils literal notranslate"><span class="pre">put</span></code> statements be handled by the implementation language’s own <code class="docutils literal notranslate"><span class="pre">eval</span></code>: the implementation language would take the place of a DSL. Multiple performance experiments showed me I could get better throughput using the former, by a wide margin. So Miller is Go under the hood with a hand-rolled DSL.</p>
|
||
<p>I do want to keep focusing on what Miller is good at – concise notation, low latency, and high throughput – and not add too much in terms of high-level-language features to the DSL. That said, some sort of customizability is a basic thing to want. As of 4.1.0 we have recursive for/while/if structures on about the same complexity level as <code class="docutils literal notranslate"><span class="pre">awk</span></code>; as of 5.0.0 we have user-defined functions and map-valued variables, again on about the same complexity level as <code class="docutils literal notranslate"><span class="pre">awk</span></code> along with optional type-declaration syntax; as of Miller 6 we have full support for arrays. While I’m excited by these powerful language features, I hope to keep new features focused on Miller’s sweet spot which is speed plus simplicity.</p>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2021, John Kerl.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |