OSDN Git Service

GDC2
[joypy/Thun.git] / docs / sphinx_docs / _build / html / pretty.html
1
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5 <html xmlns="http://www.w3.org/1999/xhtml">
6   <head>
7     <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
8     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9     <title>Tracing Joy Execution &#8212; Thun 0.4.1 documentation</title>
10     <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
11     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
12     <script type="text/javascript" src="_static/documentation_options.js"></script>
13     <script type="text/javascript" src="_static/jquery.js"></script>
14     <script type="text/javascript" src="_static/underscore.js"></script>
15     <script type="text/javascript" src="_static/doctools.js"></script>
16     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
17     <link rel="index" title="Index" href="genindex.html" />
18     <link rel="search" title="Search" href="search.html" />
19     <link rel="next" title="Function Reference" href="library.html" />
20     <link rel="prev" title="Parsing Text into Joy Expressions" href="parser.html" />
21    
22   <link rel="stylesheet" href="_static/custom.css" type="text/css" />
23   
24   
25   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
26
27   </head><body>
28   
29
30     <div class="document">
31       <div class="documentwrapper">
32         <div class="bodywrapper">
33           <div class="body" role="main">
34             
35   <div class="section" id="tracing-joy-execution">
36 <h1>Tracing Joy Execution<a class="headerlink" href="#tracing-joy-execution" title="Permalink to this headline">¶</a></h1>
37 <div class="section" id="module-joy.utils.pretty_print">
38 <span id="joy-utils-pretty-print"></span><h2><code class="docutils literal notranslate"><span class="pre">joy.utils.pretty_print</span></code><a class="headerlink" href="#module-joy.utils.pretty_print" title="Permalink to this headline">¶</a></h2>
39 <p>Pretty printing support, e.g.:</p>
40 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Joy? [23 18 * 99 +] trace
41        • 23 18 mul 99 add
42     23 • 18 mul 99 add
43  23 18 • mul 99 add
44    414 • 99 add
45 414 99 • add
46    513 • 
47
48 513 &lt;-top
49
50 joy? 
51 </pre></div>
52 </div>
53 <p>On each line the stack is printed with the top to the left, then a
54 bullet symbol,``•<a href="#id1"><span class="problematic" id="id2">``</span></a>, to represent the current locus of processing, then
55 the pending expression to the right.</p>
56 <dl class="class">
57 <dt id="joy.utils.pretty_print.TracePrinter">
58 <em class="property">class </em><code class="descclassname">joy.utils.pretty_print.</code><code class="descname">TracePrinter</code><a class="reference internal" href="_modules/joy/utils/pretty_print.html#TracePrinter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.utils.pretty_print.TracePrinter" title="Permalink to this definition">¶</a></dt>
59 <dd><p>This is what does the formatting.  You instantiate it and pass the <code class="docutils literal notranslate"><span class="pre">viewer()</span></code>
60 method to the <a class="reference internal" href="joy.html#joy.joy.joy" title="joy.joy.joy"><code class="xref py py-func docutils literal notranslate"><span class="pre">joy.joy.joy()</span></code></a> function, then print it to see the
61 trace.</p>
62 <dl class="method">
63 <dt id="joy.utils.pretty_print.TracePrinter.go">
64 <code class="descname">go</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/utils/pretty_print.html#TracePrinter.go"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.utils.pretty_print.TracePrinter.go" title="Permalink to this definition">¶</a></dt>
65 <dd><p>Return a list of strings, one for each entry in the history, prefixed
66 with enough spaces to align all the interpreter dots.</p>
67 <p>This method is called internally by the <code class="docutils literal notranslate"><span class="pre">__str__()</span></code> method.</p>
68 <table class="docutils field-list" frame="void" rules="none">
69 <col class="field-name" />
70 <col class="field-body" />
71 <tbody valign="top">
72 <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list(str)</td>
73 </tr>
74 </tbody>
75 </table>
76 </dd></dl>
77
78 <dl class="method">
79 <dt id="joy.utils.pretty_print.TracePrinter.viewer">
80 <code class="descname">viewer</code><span class="sig-paren">(</span><em>stack</em>, <em>expression</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/utils/pretty_print.html#TracePrinter.viewer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.utils.pretty_print.TracePrinter.viewer" title="Permalink to this definition">¶</a></dt>
81 <dd><p>Record the current stack and expression in the TracePrinter’s history.
82 Pass this method as the <code class="docutils literal notranslate"><span class="pre">viewer</span></code> argument to the <a class="reference internal" href="joy.html#joy.joy.joy" title="joy.joy.joy"><code class="xref py py-func docutils literal notranslate"><span class="pre">joy.joy.joy()</span></code></a> function.</p>
83 <table class="docutils field-list" frame="void" rules="none">
84 <col class="field-name" />
85 <col class="field-body" />
86 <tbody valign="top">
87 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
88 <li><strong>quote</strong> (<em>stack</em>) – A stack.</li>
89 <li><strong>expression</strong> (<em>stack</em>) – A stack.</li>
90 </ul>
91 </td>
92 </tr>
93 </tbody>
94 </table>
95 </dd></dl>
96
97 </dd></dl>
98
99 <dl class="function">
100 <dt id="joy.utils.pretty_print.trace">
101 <code class="descclassname">joy.utils.pretty_print.</code><code class="descname">trace</code><span class="sig-paren">(</span><em>stack</em>, <em>expression</em>, <em>dictionary</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/joy/utils/pretty_print.html#trace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#joy.utils.pretty_print.trace" title="Permalink to this definition">¶</a></dt>
102 <dd><p>Evaluate a Joy expression on a stack and print a trace.</p>
103 <p>This function is just like the <cite>i</cite> combinator but it also prints a
104 trace of the evaluation</p>
105 <table class="docutils field-list" frame="void" rules="none">
106 <col class="field-name" />
107 <col class="field-body" />
108 <tbody valign="top">
109 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
110 <li><strong>stack</strong> (<em>stack</em>) – The stack.</li>
111 <li><strong>expression</strong> (<em>stack</em>) – The expression to evaluate.</li>
112 <li><strong>dictionary</strong> (<em>dict</em>) – A <code class="docutils literal notranslate"><span class="pre">dict</span></code> mapping names to Joy functions.</li>
113 </ul>
114 </td>
115 </tr>
116 <tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">(stack, (), dictionary)</p>
117 </td>
118 </tr>
119 </tbody>
120 </table>
121 </dd></dl>
122
123 </div>
124 </div>
125
126
127           </div>
128         </div>
129       </div>
130       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
131         <div class="sphinxsidebarwrapper">
132   <h3><a href="index.html">Table Of Contents</a></h3>
133   <ul>
134 <li><a class="reference internal" href="#">Tracing Joy Execution</a><ul>
135 <li><a class="reference internal" href="#module-joy.utils.pretty_print"><code class="docutils literal notranslate"><span class="pre">joy.utils.pretty_print</span></code></a></li>
136 </ul>
137 </li>
138 </ul>
139 <div class="relations">
140 <h3>Related Topics</h3>
141 <ul>
142   <li><a href="index.html">Documentation overview</a><ul>
143       <li>Previous: <a href="parser.html" title="previous chapter">Parsing Text into Joy Expressions</a></li>
144       <li>Next: <a href="library.html" title="next chapter">Function Reference</a></li>
145   </ul></li>
146 </ul>
147 </div>
148   <div role="note" aria-label="source link">
149     <h3>This Page</h3>
150     <ul class="this-page-menu">
151       <li><a href="_sources/pretty.rst.txt"
152             rel="nofollow">Show Source</a></li>
153     </ul>
154    </div>
155 <div id="searchbox" style="display: none" role="search">
156   <h3>Quick search</h3>
157     <div class="searchformwrapper">
158     <form class="search" action="search.html" method="get">
159       <input type="text" name="q" />
160       <input type="submit" value="Go" />
161       <input type="hidden" name="check_keywords" value="yes" />
162       <input type="hidden" name="area" value="default" />
163     </form>
164     </div>
165 </div>
166 <script type="text/javascript">$('#searchbox').show(0);</script>
167         </div>
168       </div>
169       <div class="clearer"></div>
170     </div>
171     <div class="footer" role="contentinfo">
172 <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">
173 <img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" />
174 </a>
175 <br />
176 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Thun Documentation</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://joypy.osdn.io/" property="cc:attributionName" rel="cc:attributionURL">Simon Forman</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="https://osdn.net/projects/joypy/" rel="dct:source">https://osdn.net/projects/joypy/</a>.
177       Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.3.
178     </div>
179
180   </body>
181 </html>