miller/docs6/docs/_build/html/reference-dsl-tbf.html

87 lines
No EOL
5.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 Millers expression language &#8212; Miller 6.0.0-alpha documentation</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.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>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="nav-item nav-item-0"><a href="index.html">Miller 6.0.0-alpha documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">DSL reference: a note on the complexity of Millers expression language</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" 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 Millers 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 Millers strengths is its brevity: its 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 Millers out-of-stream variables. And the more language features Millers 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>doesnt</em> have (classes, execptions, 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, 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 languages 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. While Im excited by these powerful language features, I hope to keep new features beyond 5.0.0 focused on Millers sweet spot which is speed plus simplicity.</p>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/reference-dsl-tbf.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="nav-item nav-item-0"><a href="index.html">Miller 6.0.0-alpha documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">DSL reference: a note on the complexity of Millers expression language</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, John Kerl.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
</div>
</body>
</html>