Skip to content

Commit

Permalink
book: generate html
Browse files Browse the repository at this point in the history
  • Loading branch information
Nugine committed Jan 13, 2020
1 parent c22819c commit d1a6e41
Show file tree
Hide file tree
Showing 37 changed files with 9,336 additions and 0 deletions.
Empty file removed docs/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions docs/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file makes sure that Github Pages doesn't process mdBook's output.
256 changes: 256 additions & 0 deletions docs/1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
<!DOCTYPE HTML>
<html lang="zh-CN" class="sidebar-visible no-js light">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>1. 背景知识 - Brainfuck JIT 虚拟机教程</title>


<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff" />

<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">

<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500" rel="stylesheet" type="text/css">

<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">

<!-- Custom theme stylesheets -->



</head>
<body>
<!-- Provide site root to javascript -->
<script type="text/javascript">
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "light" : "light";
</script>

<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script type="text/javascript">
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');

if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}

if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>

<!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript">
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('no-js')
html.classList.remove('light')
html.classList.add(theme);
html.classList.add('js');
</script>

<!-- Hide / unhide sidebar before it is displayed -->
<script type="text/javascript">
var html = document.querySelector('html');
var sidebar = 'hidden';
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
}
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
</script>

<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div id="sidebar-scrollbox" class="sidebar-scrollbox">
<ol class="chapter"><li class="expanded affix "><a href="introduction.html">介绍</a></li><li class="expanded "><a href="1.html" class="active"><strong aria-hidden="true">1.</strong> 背景知识</a></li><li class="expanded "><a href="2.html"><strong aria-hidden="true">2.</strong> 启动项目</a></li><li class="expanded "><a href="3.html"><strong aria-hidden="true">3.</strong> 中间表示</a></li><li class="expanded "><a href="4.html"><strong aria-hidden="true">4.</strong> Hello, JIT</a></li><li class="expanded "><a href="5.html"><strong aria-hidden="true">5.</strong> 来点错误</a></li><li class="expanded "><a href="6.html"><strong aria-hidden="true">6.</strong> 实现虚拟机</a></li><li class="expanded "><a href="7.html"><strong aria-hidden="true">7.</strong> 生成机器码</a></li><li class="expanded "><a href="8.html"><strong aria-hidden="true">8.</strong> 命令行界面</a></li><li class="expanded affix "><a href="conclusion.html">结语</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>

<div id="page-wrapper" class="page-wrapper">

<div class="page">

<div id="menu-bar" class="menu-bar">
<div id="menu-bar-sticky-container">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</button>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>

<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>

</div>

<h1 class="menu-title">Brainfuck JIT 虚拟机教程</h1>

<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>

</div>
</div>
</div>


<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" name="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>


<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script type="text/javascript">
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>

<div id="content" class="content">
<main>
<h1><a class="header" href="#1-背景知识" id="1-背景知识">1. 背景知识</a></h1>
<h2><a class="header" href="#brainfuck-简介" id="brainfuck-简介">Brainfuck 简介</a></h2>
<p><a href="https://en.wikipedia.org/wiki/Brainfuck">https://en.wikipedia.org/wiki/Brainfuck</a></p>
<p>Brainfuck 仅包含八个指令,却是图灵完备的,理论上它可以做到任何用图灵机能做到的事情。</p>
<p>机器模型:一个字节数组,一个数据指针,一个指令指针,输入流,输出流。</p>
<p>数组初始化为全零,数据指针初始时指向数组的第一个字节,指令指针指向第一条指令。</p>
<p>字符 '&gt;':将数据指针加一。</p>
<p>字符 '&lt;':将数据指针减一。</p>
<p>字符 '+':将数据指针所指的单元加一。</p>
<p>字符 '-':将数据指针所指的单元减一。</p>
<p>字符 ',':从输入流中读取一个字节,存入数据指针所指单元。</p>
<p>字符 '.':输出数据指针所指单元的字节。</p>
<p>字符 '[':如果当前单元是 0,那么跳转到对应的 ']' 的下一条指令,否则继续执行。</p>
<p>字符 ']':如果当前单元不是 0,那么跳转到对应的 '[' 的下一条指令,否则继续执行。</p>
<p>Brainfuck 可以直接对应到 C 代码,仅用几十行就能写个从 bf 到 c 的编译器。</p>
<p>初始化</p>
<pre><code class="language-c">char array[30000] = {0};
char *ptr=array;
</code></pre>
<table><thead><tr><th>指令</th><th>C 代码</th></tr></thead><tbody>
<tr><td>&gt;</td><td>++ptr;</td></tr>
<tr><td>&lt;</td><td>--ptr;</td></tr>
<tr><td>+</td><td>++*ptr;</td></tr>
<tr><td>-</td><td>--*ptr;</td></tr>
<tr><td>.</td><td>putchar(*ptr);</td></tr>
<tr><td>,</td><td>*ptr=getchar();</td></tr>
<tr><td>[</td><td>while (*ptr) {</td></tr>
<tr><td>]</td><td>}</td></tr>
</tbody></table>
<p>Brainfuck 可视化</p>
<p><a href="http://fatiherikli.github.io/brainfuck-visualizer/">http://fatiherikli.github.io/brainfuck-visualizer/</a></p>
<h2><a class="header" href="#rust-资源" id="rust-资源">Rust 资源</a></h2>
<p>Rust 官网 <a href="https://www.rust-lang.org/">https://www.rust-lang.org/</a></p>
<p>Rust 一键安装 <a href="https://rustup.rs/">https://rustup.rs/</a></p>
<p>Rust 并不是一个能立即上手的语言,如果您是一位 Rust 新手,最好先全面了解 Rust 语言特性。</p>
<p>Rust 官网入门教程 <a href="https://www.rust-lang.org/zh-CN/learn">https://www.rust-lang.org/zh-CN/learn</a></p>
<p>中文书《Rust编程之道》 <a href="https://book.douban.com/subject/30418895/">https://book.douban.com/subject/30418895/</a></p>

</main>

<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->

<a rel="prev" href="introduction.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>



<a rel="next" href="2.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>


<div style="clear: both"></div>
</nav>
</div>
</div>

<nav class="nav-wide-wrapper" aria-label="Page navigation">

<a href="introduction.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>



<a href="2.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>

</nav>

</div>








<script type="text/javascript">
window.playpen_copyable = true;
</script>





<script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
<script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
<script src="searcher.js" type="text/javascript" charset="utf-8"></script>


<script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
<script src="highlight.js" type="text/javascript" charset="utf-8"></script>
<script src="book.js" type="text/javascript" charset="utf-8"></script>

<!-- Custom JS scripts -->




</body>
</html>
Loading

0 comments on commit d1a6e41

Please sign in to comment.