Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add lang="en" and class="notranslate" for chrome translate #1175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion site/404.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>404 Page Not Found &middot; Crafting Interpreters</title>
Expand Down
2 changes: 1 addition & 1 deletion site/a-bytecode-virtual-machine.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>A Bytecode Virtual Machine &middot; Crafting Interpreters</title>
Expand Down
6 changes: 3 additions & 3 deletions site/a-map-of-the-territory.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>A Map of the Territory &middot; Crafting Interpreters</title>
Expand Down Expand Up @@ -268,10 +268,10 @@ <h3><a href="#optimization" id="optimization"><small>2&#8202;.&#8202;1&#8202;.&#
<p>A simple example is <strong>constant folding</strong>: if some expression always evaluates to
the exact same value, we can do the evaluation at compile time and replace the
code for the expression with its result. If the user typed in this:</p>
<div class="codehilite"><pre><span class="i">pennyArea</span> = <span class="n">3.14159</span> * (<span class="n">0.75</span> / <span class="n">2</span>) * (<span class="n">0.75</span> / <span class="n">2</span>);
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">pennyArea</span> = <span class="n">3.14159</span> * (<span class="n">0.75</span> / <span class="n">2</span>) * (<span class="n">0.75</span> / <span class="n">2</span>);
</pre></div>
<p>we could do all of that arithmetic in the compiler and change the code to:</p>
<div class="codehilite"><pre><span class="i">pennyArea</span> = <span class="n">0.4417860938</span>;
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">pennyArea</span> = <span class="n">0.4417860938</span>;
</pre></div>
<p>Optimization is a huge part of the programming language business. Many language
hackers spend their entire careers here, squeezing every drop of performance
Expand Down
2 changes: 1 addition & 1 deletion site/a-tree-walk-interpreter.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>A Tree-Walk Interpreter &middot; Crafting Interpreters</title>
Expand Down
124 changes: 62 additions & 62 deletions site/a-virtual-machine.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site/acknowledgements.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Acknowledgements &middot; Crafting Interpreters</title>
Expand Down
14 changes: 7 additions & 7 deletions site/appendix-i.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Appendix I &middot; Crafting Interpreters</title>
Expand Down Expand Up @@ -89,12 +89,12 @@ <h2><a href="#syntax-grammar" id="syntax-grammar"><small>A1&#8202;.&#8202;1</sma
<p>The syntactic grammar is used to parse the linear sequence of tokens into the
nested syntax tree structure. It starts with the first rule that matches an
entire Lox program (or a single REPL entry).</p>
<div class="codehilite"><pre><span class="i">program</span> → <span class="i">declaration</span>* <span class="t">EOF</span> ;
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">program</span> → <span class="i">declaration</span>* <span class="t">EOF</span> ;
</pre></div>
<h3><a href="#declarations" id="declarations"><small>A1&#8202;.&#8202;1&#8202;.&#8202;1</small>Declarations</a></h3>
<p>A program is a series of declarations, which are the statements that bind new
identifiers or any of the other statement types.</p>
<div class="codehilite"><pre><span class="i">declaration</span> → <span class="i">classDecl</span>
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">declaration</span> → <span class="i">classDecl</span>
| <span class="i">funDecl</span>
| <span class="i">varDecl</span>
| <span class="i">statement</span> ;
Expand All @@ -107,7 +107,7 @@ <h3><a href="#declarations" id="declarations"><small>A1&#8202;.&#8202;1&#8202;.&
<h3><a href="#statements" id="statements"><small>A1&#8202;.&#8202;1&#8202;.&#8202;2</small>Statements</a></h3>
<p>The remaining statement rules produce side effects, but do not introduce
bindings.</p>
<div class="codehilite"><pre><span class="i">statement</span> → <span class="i">exprStmt</span>
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">statement</span> → <span class="i">exprStmt</span>
| <span class="i">forStmt</span>
| <span class="i">ifStmt</span>
| <span class="i">printStmt</span>
Expand All @@ -133,7 +133,7 @@ <h3><a href="#expressions" id="expressions"><small>A1&#8202;.&#8202;1&#8202;.&#8
different levels of precedence. Some grammars for languages do not directly
encode the precedence relationships and specify that elsewhere. Here, we use a
separate rule for each precedence level to make it explicit.</p>
<div class="codehilite"><pre><span class="i">expression</span> → <span class="i">assignment</span> ;
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">expression</span> → <span class="i">assignment</span> ;

<span class="i">assignment</span> → ( <span class="i">call</span> <span class="s">&quot;.&quot;</span> )? <span class="t">IDENTIFIER</span> <span class="s">&quot;=&quot;</span> <span class="i">assignment</span>
| <span class="i">logic_or</span> ;
Expand All @@ -154,15 +154,15 @@ <h3><a href="#expressions" id="expressions"><small>A1&#8202;.&#8202;1&#8202;.&#8
<h3><a href="#utility-rules" id="utility-rules"><small>A1&#8202;.&#8202;1&#8202;.&#8202;4</small>Utility rules</a></h3>
<p>In order to keep the above rules a little cleaner, some of the grammar is
split out into a few reused helper rules.</p>
<div class="codehilite"><pre><span class="i">function</span> → <span class="t">IDENTIFIER</span> <span class="s">&quot;(&quot;</span> <span class="i">parameters</span>? <span class="s">&quot;)&quot;</span> <span class="i">block</span> ;
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">function</span> → <span class="t">IDENTIFIER</span> <span class="s">&quot;(&quot;</span> <span class="i">parameters</span>? <span class="s">&quot;)&quot;</span> <span class="i">block</span> ;
<span class="i">parameters</span> → <span class="t">IDENTIFIER</span> ( <span class="s">&quot;,&quot;</span> <span class="t">IDENTIFIER</span> )* ;
<span class="i">arguments</span> → <span class="i">expression</span> ( <span class="s">&quot;,&quot;</span> <span class="i">expression</span> )* ;
</pre></div>
<h2><a href="#lexical-grammar" id="lexical-grammar"><small>A1&#8202;.&#8202;2</small>Lexical Grammar</a></h2>
<p>The lexical grammar is used by the scanner to group characters into tokens.
Where the syntax is <a href="https://en.wikipedia.org/wiki/Context-free_grammar">context free</a>, the lexical grammar is <a href="https://en.wikipedia.org/wiki/Regular_grammar">regular</a><span class="em">&mdash;</span>note
that there are no recursive rules.</p>
<div class="codehilite"><pre><span class="t">NUMBER</span> → <span class="t">DIGIT</span>+ ( <span class="s">&quot;.&quot;</span> <span class="t">DIGIT</span>+ )? ;
<div class="codehilite notranslate"><pre class="notranslate"><span class="t">NUMBER</span> → <span class="t">DIGIT</span>+ ( <span class="s">&quot;.&quot;</span> <span class="t">DIGIT</span>+ )? ;
<span class="t">STRING</span> → <span class="s">&quot;</span><span class="e">\&quot;</span><span class="s">&quot;</span> &lt;<span class="i">any</span> <span class="i">char</span> <span class="i">except</span> <span class="s">&quot;</span><span class="e">\&quot;</span><span class="s">&quot;</span>&gt;* <span class="s">&quot;</span><span class="e">\&quot;</span><span class="s">&quot;</span> ;
<span class="t">IDENTIFIER</span> → <span class="t">ALPHA</span> ( <span class="t">ALPHA</span> | <span class="t">DIGIT</span> )* ;
<span class="t">ALPHA</span> → <span class="s">&quot;a&quot;</span> ... <span class="s">&quot;z&quot;</span> | <span class="s">&quot;A&quot;</span> ... <span class="s">&quot;Z&quot;</span> | <span class="s">&quot;_&quot;</span> ;
Expand Down
Loading