2020-07-19 20:31:23 +03:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
< html >
< head >
< title > Interpreting< / title >
< link href = "../docs-assets/Breadcrumbs.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< meta name = "viewport" content = "width=device-width initial-scale=1" >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" >
< meta http-equiv = "Content-Language" content = "en-gb" >
< link href = "../docs-assets/Contents.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Progress.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Navigation.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Fonts.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Base.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< script >
function togglePopup(material_id) {
var popup = document.getElementById(material_id);
popup.classList.toggle("show");
}
< / script >
< link href = "../docs-assets/Popups.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Colours.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< / head >
< body class = "commentary-font" >
< nav role = "navigation" >
< h1 > < a href = "../index.html" >
< img src = "../docs-assets/Inform.png" height = 72" >
< / a > < / h1 >
2022-04-04 20:31:44 +03:00
< ul > < li > < a href = "../index.html" > home< / a > < / li >
< / ul > < h2 > Compiler< / h2 > < ul >
< li > < a href = "../structure.html" > structure< / a > < / li >
< li > < a href = "../inbuildn.html" > inbuild< / a > < / li >
< li > < a href = "../inform7n.html" > inform7< / a > < / li >
< li > < a href = "../intern.html" > inter< / a > < / li >
< li > < a href = "../services.html" > services< / a > < / li >
2022-04-18 17:46:46 +03:00
< li > < a href = "../secrets.html" > secrets< / a > < / li >
2022-04-04 20:31:44 +03:00
< / ul > < h2 > Other Tools< / h2 > < ul >
< li > < a href = "../inblorbn.html" > inblorb< / a > < / li >
< li > < a href = "../indocn.html" > indoc< / a > < / li >
< li > < a href = "../inform6.html" > inform6< / a > < / li >
< li > < a href = "../inpolicyn.html" > inpolicy< / a > < / li >
< li > < a href = "../inrtpsn.html" > inrtps< / a > < / li >
2022-04-05 14:14:27 +03:00
< / ul > < h2 > Resources< / h2 > < ul >
< li > < a href = "../extensions.html" > extensions< / a > < / li >
< li > < a href = "../kits.html" > kits< / a > < / li >
2022-04-04 20:31:44 +03:00
< / ul > < h2 > Repository< / h2 > < ul >
< li > < a href = "https://github.com/ganelson/inform" > < img src = "../docs-assets/github.png" height = 18 > github< / a > < / li >
< / ul > < h2 > Related Projects< / h2 > < ul >
2022-11-11 00:34:19 +02:00
< li > < a href = "../../../inweb/index.html" > inweb< / a > < / li >
< li > < a href = "../../../intest/index.html" > intest< / a > < / li >
2020-07-19 20:31:23 +03:00
< / ul >
< / nav >
< main role = "main" >
<!-- Weave of 'Interpreting' generated by Inweb -->
< div class = "breadcrumbs" >
2022-04-04 20:31:44 +03:00
< ul class = "crumbs" > < li > < a href = "../index.html" > Home< / a > < / li > < li > < a href = "../services.html" > Services< / a > < / li > < li > < a href = "index.html" > linguistics-test< / a > < / li > < li > < a href = "index.html#1" > Chapter 1: Scaffolding< / a > < / li > < li > < b > Interpreting< / b > < / li > < / ul > < / div >
2020-07-19 20:31:23 +03:00
< p class = "purpose" > Printing out diagrams of the sentences.< / p >
2020-08-18 00:57:45 +03:00
< p class = "commentary firstcommentary" > < a id = "SP1" class = "paragraph-anchor" > < / a > < b > § 1. < / b > This is where we could put an interpreter or compiler; we now have a nice
2020-07-19 20:31:23 +03:00
tidy syntax tree to look at. Instead, we'll just print it out.
< / p >
< pre class = "displayed-code all-displayed-code code-font" >
2020-07-27 15:26:59 +03:00
< span class = "reserved-syntax" > void< / span > < span class = "plain-syntax" > < / span > < span class = "function-syntax" > Interpreting::go< / span > < button class = "popup" onclick = "togglePopup('usagePopup1')" > < span class = "comment-syntax" > ?< / span > < span class = "popuptext" id = "usagePopup1" > Usage of < span class = "code-font" > < span class = "function-syntax" > Interpreting::go< / span > < / span > :< br / > Program Control - < a href = "1-pc.html#SP3" > § 3< / a > < / span > < / button > < span class = "plain-syntax" > (< / span > < span class = "reserved-syntax" > parse_node_tree< / span > < span class = "plain-syntax" > *< / span > < span class = "identifier-syntax" > syntax_tree< / span > < span class = "plain-syntax" > ) {< / span >
2020-07-19 20:31:23 +03:00
< span class = "plain-syntax" > < / span > < a href = "../syntax-module/2-st.html#SP10" class = "function-link" > < span class = "function-syntax" > SyntaxTree::traverse< / span > < / a > < span class = "plain-syntax" > (< / span > < span class = "identifier-syntax" > syntax_tree< / span > < span class = "plain-syntax" > , < / span > < a href = "1-int.html#SP1" class = "function-link" > < span class = "function-syntax" > Interpreting::diagram< / span > < / a > < span class = "plain-syntax" > );< / span >
< span class = "plain-syntax" > }< / span >
< span class = "reserved-syntax" > int< / span > < span class = "plain-syntax" > < / span > < span class = "identifier-syntax" > sentence_counter< / span > < span class = "plain-syntax" > = < / span > < span class = "constant-syntax" > 1< / span > < span class = "plain-syntax" > ;< / span >
< span class = "reserved-syntax" > void< / span > < span class = "plain-syntax" > < / span > < span class = "function-syntax" > Interpreting::diagram< / span > < span class = "plain-syntax" > (< / span > < span class = "reserved-syntax" > parse_node< / span > < span class = "plain-syntax" > *< / span > < span class = "identifier-syntax" > p< / span > < span class = "plain-syntax" > ) {< / span >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > if< / span > < span class = "plain-syntax" > (< / span > < a href = "../syntax-module/2-pn.html#SP5" class = "function-link" > < span class = "function-syntax" > Node::get_type< / span > < / a > < span class = "plain-syntax" > (< / span > < span class = "identifier-syntax" > p< / span > < span class = "plain-syntax" > ) == < / span > < span class = "constant-syntax" > SENTENCE_NT< / span > < span class = "plain-syntax" > ) {< / span >
< span class = "plain-syntax" > < / span > < span class = "identifier-syntax" > LOG< / span > < span class = "plain-syntax" > (< / span > < span class = "string-syntax" > "(%d) %W\n\n"< / span > < span class = "plain-syntax" > , < / span > < span class = "identifier-syntax" > sentence_counter< / span > < span class = "plain-syntax" > ++, < / span > < a href = "../syntax-module/2-pn.html#SP4" class = "function-link" > < span class = "function-syntax" > Node::get_text< / span > < / a > < span class = "plain-syntax" > (< / span > < span class = "identifier-syntax" > p< / span > < span class = "plain-syntax" > ));< / span >
2020-08-04 19:16:11 +03:00
< span class = "plain-syntax" > < / span > < a href = "../syntax-module/2-pn.html#SP16" class = "function-link" > < span class = "function-syntax" > Node::log_subtree< / span > < / a > < span class = "plain-syntax" > (< / span > < span class = "identifier-syntax" > DL< / span > < span class = "plain-syntax" > , < / span > < span class = "identifier-syntax" > p< / span > < span class = "plain-syntax" > );< / span >
2020-07-19 20:31:23 +03:00
< span class = "plain-syntax" > < / span > < span class = "identifier-syntax" > LOG< / span > < span class = "plain-syntax" > (< / span > < span class = "string-syntax" > "\n"< / span > < span class = "plain-syntax" > );< / span >
< span class = "plain-syntax" > }< / span >
< span class = "plain-syntax" > }< / span >
< / pre >
< nav role = "progress" > < div class = "progresscontainer" >
< ul class = "progressbar" > < li class = "progressprev" > < a href = "1-dgr2.html" > ❮ < / a > < / li > < li class = "progresscurrentchapter" > 1< / li > < li class = "progresssection" > < a href = "1-pc.html" > pc< / a > < / li > < li class = "progresssection" > < a href = "1-rlt.html" > rlt< / a > < / li > < li class = "progresssection" > < a href = "1-bnk.html" > bnk< / a > < / li > < li class = "progresssection" > < a href = "1-dgr2.html" > dgr2< / a > < / li > < li class = "progresscurrent" > int< / li > < li class = "progressnextoff" > ❯ < / li > < / ul > < / div >
< / nav > <!-- End of weave -->
< / main >
< / body >
< / html >