Skip to content
Browse files

Updated description of the Core settings

  • Loading branch information...
1 parent 3791f05 commit 19052593e58e03839d64fdc5c6369e342b8fdd42 Salve J. Nilsen committed
Showing with 91 additions and 115 deletions.
  1. +23 −28 docs/architecture.html
  2. +68 −87 docs/architecture.svg
View
51 docs/architecture.html
@@ -1,10 +1,10 @@
<html>
<head>
- <title>Rakudo architectural overview</title>
+ <title>How Rakudo compiles a Perl 6 program</title>
</head>
<body style="margin:2ex">
-<h1>Rakudo architectural overview</h1>
+<h1>How Rakudo compiles a Perl 6 program</h1>
<object
style="margin:2ex; float:left"
@@ -15,52 +15,50 @@
</object>
<a id="action-methods" />
-<h2 id="parser" >Parser and Action methods</h2>
+<h2 id="parser" >Parser and Action Methods</h2>
-<p>The Perl 6 source code is transformed in various stages. The first are the Parser and Action Method stage. This stage creates a parse tree out of the Perl 6 source code and the fires off Action methods that annotate the parse tree, incrementally turning it into an Abstract Syntax Tree (QAST). When an Action Method is done annotating, the control is handed back to the Parser, which then continues parsing the Perl 6 code.</p>
+<p>The Perl 6 source code is transformed in various stages, of which the first two are the Parser and Action Method stages. The Parser creates a parse tree out of the Perl 6 source code and then gives control to appropriate action methods that annotate the parse tree, incrementally turning it into an Abstract Syntax Tree (AST). When an action method is done annotating, control is handed back to the parser, which then continues parsing the Perl 6 code and "fire off" new action methods as it goes.</p>
-<p>The result of these two stages is an "improved PAST" (Perl 6 Abstract Syntax Tree) named QAST. This tree is then passed on to the QAST compiler.</p>
+<p>The result of these two stages interacting is an "improved PAST" (Perl 6 Abstract Syntax Tree) called QAST. This tree is then passed on to the QAST compiler.</p>
-<p>The Parser and Action methods are implemented in "Not Quite Perl 6" (NQP) and are part of Rakudo and hosted in the Rakudo repository at <a href="../src/Perl6/Grammar.pm">src/Perl6/Grammar.pm</a> and <a href="../src/Perl6/Actions.pm">src/Perl6/Actions.pm</a>.</p>
+<p>The parser and action methods are implemented in "Not Quite Perl 6" (NQP) and are part of Rakudo and hosted in the Rakudo repository at <a href="../src/Perl6/Grammar.pm">src/Perl6/Grammar.pm</a> and <a href="../src/Perl6/Actions.pm">src/Perl6/Actions.pm</a>.</p>
-<h2 id="QAST-compiler">QAST compiler</h2>
+<h2 id="the-world">The World</h2>
-<p>The QAST compiler transforms the abstract syntax tree into a PIRT (Parrot Intermediate Representation Tree). In this phase we have the program represented as an AST, and need to translate this into the PIR that the Parrot VM understands. To do this, the QAST compiler does a series of translations on the AST, creating PIRT nodes that implement the operations specified by the QAST nodes.</p>
+<p>The World is where the parser and the action methods store any declarations they encouter during their runs, including Classes, Types, Signatures, Constants, Subs and Methods.</p>
-<p>In addition, the QAST compiler is responsible for serializing The World in such a way that the later stages can get access to the declarations stored there during the Parser and Action methods stages.</p>
-<p>There's also opportunity to apply some VM-specific optimizations at this point. When this is done, the resulting PIRT is passed to the PIRT serializer.</p>
+<h2 id="qast-compiler">QAST compiler</h2>
-<p>This stage is described in <a href="../nqp/src/QAST/">nqp/src/QAST/</a>.</p>
+<p>The QAST compiler transforms the abstract syntax tree into a PIRT (Parrot Intermediate Representation Tree). To do this, the QAST compiler does a series of translations on the AST, creating PIRT nodes that implement the operations specified by the QAST nodes.</p>
-<h2 id="The-World">The World</h2>
+<p>In addition, the QAST compiler is responsible for serializing <em>The World</em> in such a way that later stages can get access to the declarations stored there during the parser and action methods stages.</p>
-<p>The World is where the parser and the action methods store any declarations they encouter during their runs.</p>
+<p>There's also opportunity to apply some VM-specific optimizations at this point. When this is done, the resulting PIRT is passed to the PIRT serializer.</p>
+<p>This stage is described in the different files in the <a href="../nqp/src/QAST/">nqp/src/QAST/</a> directory.</p>
-<h2 id="PIRT-serializer">PIRT serializer</h2>
+<h2 id="pirt-serializer">PIRT serializer</h2>
-<p>The PIRT serializer "squashes" the PIR tree into a format that can be passed to Parrot itself and it's IMCC (InterMediate Code Compiler) stage.</p>
+<p>The PIRT serializer "squashes" the PIR Tree into a format that can be passed to Parrot itself and it's IMCC (InterMediate Code Compiler) stage.</p>
-<p>You can read more about this at <a href="../nqp/src/QAST/PIRT.nqp">nqp/src/QAST/PIRT.nqp</a></p>
+<p>You can read more about this at <a href="../nqp/src/QAST/PIRT.nqp">nqp/src/QAST/PIRT.nqp</a>.</p>
<a id="parrot-runtime" />
<h2 id="imcc">IMCC and Parrot runtime</h2>
-<p>The IMCC (InterMediate Code Compiler) receives the PIR code from the PIRT serializer and then transforms it into Parrot Byte Code (PBC). IMCC is parrot's PIR compiler, written in C and statically linked into parrot. The byte code can then be stored to disk or executed in memory by one of the <em>run cores</em> availabe as part of the Parrot runtime. This is in some sense the heart of Parrot - or one of the hearts; There are several different cores available, includin one for just-in-time compilation (JIT), one for debugging and more.</p>
+<p>The IMCC (InterMediate Code Compiler) receives the PIR code from the PIRT serializer and then transforms it into Parrot Byte Code (PBC). IMCC is parrot's PIR compiler, written in C and statically linked into parrot. The byte code can then be stored to disk or executed in memory by one of the <em>run cores</em> availabe as part of the Parrot runtime. This is in some sense the heart of Parrot - or one of the hearts; There are several different cores available, including one for just-in-time compilation (JIT), one for debugging and others.</p>
-<p>You can find out more about this on <a href="../parrot/docs/imcc">parrot/docs/imcc/</a></p>
+<p>You can find out more about the IMCC in the <a href="../parrot/docs/imcc/">parrot/docs/imcc/</a> directory, and about the different run cores in the <a href="../parrot/docs/running.pod">parrot/docs/running.pod</a></p>
<h2 id="pmc-dynops">PMCs and dynops</h2>
<p>There are also some supporting custom types and operations in Rakudo called <em>dynamic PMCs</em> and <em>dynamic ops</em> (dynops) which are written in C, and helper functions written in NQP and PIR. These supporting libraries exist for adding features to Parrot that are needed to handle special features in Perl 6.</p>
-<h2 id="setting">Core setting library</h2>
+<h2 id="core-setting">Core setting library</h2>
-<p>The part of Rakudo described so far is the <em>stage one</em> compiler. In the build process it is compiled first, and then it compiles the <em>Core setting library</em> down to PBC. "Core setting library" is a fancy term describing the built-in functions which are written in Perl 6, whose purpose is to be the Perl 6 standard library. The result of this compilation is linked together with the stage one compiler and Parrot, the result is the <code>perl6</code> executable.</p>
-
-<p>The core setting library informs the Parser and Action methods when compiling a Perl 6 program.</p>
+<p>The core settings library is the library containing the methods, classes and almost all other features that make up the Rakudo Perl 6 implementation. This library is tightly coupled with the <code>perl6</code> binary, and loaded by default every time <code>perl6</code> is run.</p>
<h2 id="glossary">Glossary</h2>
@@ -78,16 +76,13 @@ <h2 id="glossary">Glossary</h2>
<dd>Parrot Byte Code, the binary form to which all parrot programs are compiled in the end.</dd>
<dt>Core setting</dt>
- <dd>The core setting is the Perl 6 standard library.</dd>
+ <dd>The core setting is the Perl 6 standard library. It is part of the perl6 executable, and contains all the standard features available in Perl 6.</dd>
<dt>QAST</dt>
- <dd></dd>
-
- <dt>JIT</dt>
- <dd></dd>
+ <dd>The "improved" Abstract Syntax Tree used in Rakudo Perl 6. It contains information about how the program is structured, and what it is supposed to do.</dd>
<dt>PIRT</dt>
- <dd></dd>
+ <dd>Parrot Intermediate Representation Tree.</dd>
</dl>
View
155 docs/architecture.svg
@@ -67,8 +67,8 @@
id="base"
showgrid="false"
inkscape:zoom="1.4142136"
- inkscape:cx="237.31829"
- inkscape:cy="206.75371"
+ inkscape:cx="238.0254"
+ inkscape:cy="213.17704"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:current-layer="svg2"
@@ -80,41 +80,12 @@
showguides="true"
inkscape:guide-bbox="true" />
<defs
- id="defs4">
- <marker
- inkscape:stockid="TriangleOutS"
- orient="auto"
- refY="0"
- refX="0"
- id="TriangleOutS-5"
- style="overflow:visible">
- <path
- id="path4004-6"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#ffbb55;fill-rule:evenodd;stroke:#ffbb55;stroke-width:1pt"
- transform="scale(0.2,0.2)"
- inkscape:connector-curvature="0" />
- </marker>
- <marker
- inkscape:stockid="TriangleOutS"
- orient="auto"
- refY="0"
- refX="0"
- id="TriangleOutS-5-6"
- style="overflow:visible">
- <path
- id="path4004-6-4"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#ffbb55;fill-rule:evenodd;stroke:#ffbb55;stroke-width:1pt"
- transform="scale(0.2,0.2)"
- inkscape:connector-curvature="0" />
- </marker>
- </defs>
+ id="defs4" />
<a
- xlink:href="architecture.html#setting"
- target="_top"
+ xlink:href="architecture.html#core-setting"
+ transform="matrix(0.5,0,0,0.5,17.715316,-37.789196)"
id="a66"
- transform="matrix(0.5,0,0,0.5,17.715316,-37.789196)">
+ target="_top">
<rect
width="188.60774"
height="163.09328"
@@ -135,29 +106,39 @@
y="272.36749"
id="tspan2577">(Perl 6)</tspan></text>
</a>
- <g
- id="g3077"
- transform="translate(53.630226,3.3021826)">
- <rect
- y="41.327747"
- x="254.90707"
- height="153.9113"
- width="47.905518"
- id="rect3083"
- style="fill:#fffa68;fill-opacity:1;stroke:none" />
- <text
- transform="matrix(0,-1,1,0,0,0)"
- sodipodi:linespacing="125%"
- id="text3853"
- y="282.95706"
- x="-171.74826"
- style="font-size:13.05000019px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
- xml:space="preserve"><tspan
- y="282.95706"
- x="-171.74826"
- id="tspan3855"
- sodipodi:role="line">The World (NQP)</tspan></text>
- </g>
+ <a
+ xlink:href="architecture.html#the-world"
+ target="_top"
+ id="a3082">
+ <g
+ id="g3075">
+ <rect
+ style="fill:#fffa68;fill-opacity:1;stroke:none"
+ id="rect3083"
+ width="47.905518"
+ height="153.9113"
+ x="308.53729"
+ y="44.629929" />
+ <g
+ id="g3070">
+ <a
+ id="a3066">
+ <text
+ xml:space="preserve"
+ style="font-size:13.05000019px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
+ x="-175.05045"
+ y="336.58728"
+ id="text3853"
+ sodipodi:linespacing="125%"
+ transform="matrix(0,-1,1,0,0,0)"><tspan
+ sodipodi:role="line"
+ id="tspan3855"
+ x="-175.05045"
+ y="336.58728">The World (NQP)</tspan></text>
+ </a>
+ </g>
+ </g>
+ </a>
<path
inkscape:connector-curvature="0"
id="path3281"
@@ -165,9 +146,9 @@
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#ffbb55;fill-opacity:1;stroke:none;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" />
<a
xlink:href="architecture.html#parser"
- id="a61"
+ transform="matrix(0.5,0,0,0.5,12.2667,-77.083296)"
target="_top"
- transform="matrix(0.5,0,0,0.5,12.2667,-77.083296)">
+ id="a61">
<desc
id="desc3046">The Perl 6 source code is transformed in various stages. The first one is the parser stage, which creates a parse tree out of the Perl 6 source code.
@@ -206,9 +187,9 @@ The parser stage is implemented in &quot;Not Quite Perl 6&quot; (NQP) and is par
inkscape:transform-center-y="-0.02913637" />
<a
xlink:href="architecture.html#action-methods"
- id="action-methods"
+ transform="matrix(0.5,0,0,0.5,12.266679,-97.23971)"
target="_top"
- transform="matrix(0.5,0,0,0.5,12.266679,-97.23971)">
+ id="action-methods">
<desc
id="desc3064">The action methods are applied to the parse tree at the same time as the parser builds it. The result of this process is the Abstract Syntax Tree that is sent to the QAST compiler.</desc>
<title
@@ -236,10 +217,10 @@ The parser stage is implemented in &quot;Not Quite Perl 6&quot; (NQP) and is par
inkscape:transform-center-x="-0.9144769"
inkscape:transform-center-y="0.6733995" />
<a
- xlink:href="architecture.html#post-compiler"
- id="a41"
+ xlink:href="architecture.html#pirt-serializer"
+ transform="matrix(0.5,0,0,0.5,12.26668,-98.103967)"
target="_top"
- transform="matrix(0.5,0,0,0.5,12.26668,-98.103967)">
+ id="a41">
<rect
width="333.35034"
height="61.619305"
@@ -258,10 +239,10 @@ The parser stage is implemented in &quot;Not Quite Perl 6&quot; (NQP) and is par
id="tspan2549">PIRT serializer (NQP)</tspan></text>
</a>
<a
- xlink:href="architecture.html#past-compiler"
- id="a46"
+ xlink:href="architecture.html#qast-compiler"
+ transform="matrix(0.5,0,0,0.5,12.26668,-98.091211)"
target="_top"
- transform="matrix(0.5,0,0,0.5,12.26668,-98.091211)">
+ id="a46">
<rect
width="333.35034"
height="61.619305"
@@ -281,9 +262,9 @@ The parser stage is implemented in &quot;Not Quite Perl 6&quot; (NQP) and is par
</a>
<a
xlink:href="architecture.html#imcc"
- id="a51"
+ transform="matrix(0.5,0,0,0.5,12.266678,-98.116724)"
target="_top"
- transform="matrix(0.5,0,0,0.5,12.266678,-98.116724)">
+ id="a51">
<rect
width="333.35034"
height="61.619305"
@@ -364,10 +345,10 @@ The parser stage is implemented in &quot;Not Quite Perl 6&quot; (NQP) and is par
y="301.65015"
id="tspan2527">PIR</tspan></text>
<a
- xlink:href="architecture.html#parrot-runloops"
- target="_top"
+ xlink:href="architecture.html#parrot-runtime"
+ transform="matrix(0.5,0,0,0.5,12.266687,-98.428182)"
id="a101"
- transform="matrix(0.5,0,0,0.5,12.266687,-98.428182)">
+ target="_top">
<desc
id="desc3042">The POST compiler emits PIR, which IMCC transforms into byte code. IMCC is parrot's PIR compiler, written in C and statically linked into parrot. The byte code (PBC) can then be stored to disk, or executed in memory by a so-called run core or run loop, which is in some sense the heart of parrot - or one of the hearts, because there are several different ones available (one for just-in-time compilation (JIT), one for debugging etc.).
@@ -406,37 +387,37 @@ There are also some supporting custom types and operations in Rakudo called dyna
id="tspan2541"
y="382.36429"
x="178.24348">PBC</tspan></text>
- <g
- id="g3077-7"
- transform="translate(53.63025,218.88296)">
+ <a
+ xlink:href="architecture.html#pmc-dynops"
+ target="_top"
+ id="a3110">
<g
- id="g3059-4"
- transform="translate(-32.73544,-1.5968508)">
+ id="g3104">
<rect
style="fill:#55ff99;fill-opacity:1;stroke:none"
id="rect3083-4"
width="47.905518"
height="103.10033"
- x="287.64252"
- y="93.73558" />
+ x="308.53732"
+ y="311.0217" />
<text
xml:space="preserve"
style="font-size:13.05000019px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
- x="-145.08183"
- y="306.92456"
+ x="-362.36795"
+ y="327.81937"
id="text3853-9"
sodipodi:linespacing="125%"
transform="matrix(0,-1,1,0,0,0)"><tspan
sodipodi:role="line"
id="tspan3855-2"
- x="-145.08183"
- y="306.92456">PMC &amp;</tspan><tspan
+ x="-362.36795"
+ y="327.81937">PMC &amp;</tspan><tspan
sodipodi:role="line"
- x="-145.08183"
- y="323.23706"
+ x="-362.36795"
+ y="344.13187"
id="tspan3229">dynops (C)</tspan></text>
</g>
- </g>
+ </a>
<path
style="fill:#ffbb55"
d="m 304.45517,318.86055 -4.34646,0 -0.008,-4.48275 -7.83783,12.52446 7.89841,12.0777 -0.008,-4.49033 6.86003,0 0,-15.62908 z"

0 comments on commit 1905259

Please sign in to comment.
Something went wrong with that request. Please try again.