Skip to content

Commit 7d75694

Browse files
committed
merge changes with Berea fixes
1 parent b85a1b2 commit 7d75694

5 files changed

Lines changed: 69 additions & 58 deletions

File tree

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export BOOKDIR=$(HOME)/Runestone/books/thinkcspy
22
export COMPDIR=$(HOME)/Runestone/RunestoneComponents
33
export RSURI = https://runestone.academy/cdn/runestone/
44

5-
.PHONY: pretext html pdf
5+
.PHONY: pretext html pdf runestone
66

77
help:
88
@echo "Unless you are converting RST to PTX you you should use this Makefile!!!!"
@@ -32,3 +32,8 @@ html:
3232
pdf:
3333
python ~/src/pretext/pretext/pretext -c all -f pdf -p $(BOOKDIR)/pretext/publication-rs-for-all.xml -x debug.rs.services.file /Users/bmiller/Runestone/RunestoneComponents/runestone/dist/webpack_static_imports.xml -d $(BOOKDIR)/pdf $(BOOKDIR)/pretext/thinkcspy.ptx
3434

35+
runestone:
36+
python ~/src/pretext/pretext/pretext -c all -f html -p $(BOOKDIR)/pretext/publication-rs-academy.xml -d $(BOOKDIR)/runestone $(BOOKDIR)/pretext/thinkcspy.ptx
37+
38+
profile:
39+
python -m cProfile -s cumulative ~/src/pretext/pretext/pretext -c all -f html -p $(BOOKDIR)/pretext/publication-rs-for-all.xml -d $(BOOKDIR)/beta $(BOOKDIR)/pretext/thinkcspy.ptx

pretext/GeneralIntro/FormalandNaturalLanguages.ptx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?xml version="1.0"?>
22
<section xml:id="general-intro_formal-and-natural-languages">
33
<title>Formal and Natural Languages</title>
4-
<p><term>Natural languages</term> are the languages that people speak, such as English,
4+
<p>
5+
<term>Natural languages</term> are the languages that people speak, such as English,
56
Spanish, and French. They were not designed by people (although people try to
67
impose some order on them); they evolved naturally.</p>
7-
<p><term>Formal languages</term> are languages that are designed by people for specific
8+
<p>
9+
<term>Formal languages</term> are languages that are designed by people for specific
810
applications. For example, the notation that mathematicians use is a formal
911
language that is particularly good at denoting relationships among numbers and
1012
symbols. Chemists use a formal language to represent the chemical structure of
@@ -19,16 +21,18 @@
1921
Tokens are the basic elements of the language, such as words, numbers, and
2022
chemical elements. One of the problems with <c>3=+6$</c> is that <c>$</c> is not a
2123
legal token in mathematics (at least as far as we know). Similarly,
22-
<subscript>2</subscript>Zz is not legal because there is no element with the abbreviation
23-
<c>Zz</c>.</p>
24+
<subscript>2</subscript>Zz is not legal because there is no element with the abbreviation
25+
<c>Zz</c>.
26+
</p>
2427
<p>The second type of syntax rule pertains to the <term>structure</term> of a statement&#x2014;
2528
that is, the way the tokens are arranged. The statement <c>3=+6$</c> is
2629
structurally illegal because you can't place a plus sign immediately after an
2730
equal sign. Similarly, molecular formulas have to have subscripts after the
2831
element name, not before.</p>
2932
<p>When you read a sentence in English or a statement in a formal language, you
3033
have to figure out what the structure of the sentence is (although in a natural
31-
language you do this subconsciously). This process is called <term>parsing</term>.</p>
34+
language you do this subconsciously). This process is called <term>parsing</term>.
35+
</p>
3236
<p>For example, when you hear the sentence, <q>The other shoe fell</q>, you understand
3337
that the other shoe is the subject and fell is the verb. Once you have parsed
3438
a sentence, you can figure out what it means, or the <term>semantics</term> of the sentence.
@@ -107,31 +111,31 @@
107111
</statement>
108112
<feedback>
109113
Actually both languages can be parsed (determining the structure of the sentence), but formal languages can be parsed more easily in software.
110-
</feedback>
114+
</feedback>
111115
</choice>
112116
<choice correct="yes">
113117
<statement>
114118
<p>ambiguity, redundancy, and literalness.</p>
115119
</statement>
116120
<feedback>
117121
All of these can be present in natural languages, but cannot exist in formal languages.
118-
</feedback>
122+
</feedback>
119123
</choice>
120124
<choice>
121125
<statement>
122126
<p>there are no differences between natural and formal languages.</p>
123127
</statement>
124128
<feedback>
125129
There are several differences between the two but they are also similar.
126-
</feedback>
130+
</feedback>
127131
</choice>
128132
<choice>
129133
<statement>
130134
<p>tokens, structure, syntax, and semantics.</p>
131135
</statement>
132136
<feedback>
133137
These are the similarities between the two.
134-
</feedback>
138+
</feedback>
135139
</choice>
136140
</choices>
137141
</exercise>
@@ -146,15 +150,15 @@
146150
</statement>
147151
<feedback>
148152
It usually takes longer to read a program because the structure is as important as the content and must be interpreted in smaller pieces for understanding.
149-
</feedback>
153+
</feedback>
150154
</choice>
151155
<choice correct="yes">
152156
<statement>
153157
<p>False</p>
154158
</statement>
155159
<feedback>
156160
It usually takes longer to read a program because the structure is as important as the content and must be interpreted in smaller pieces for understanding.
157-
</feedback>
161+
</feedback>
158162
</choice>
159163
</choices>
160164
</exercise>

pretext/SimplePythonData/VariableNamesandKeywords.ptx

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0"?>
22
<section xml:id="simple-python-data_variable-names-and-keywords">
33
<title>Variable Names and Keywords</title>
4-
<p><term>Variable names</term> can be arbitrarily long. They can contain both letters and
4+
<p>
5+
<term>Variable names</term> can be arbitrarily long. They can contain both letters and
56
digits, but they have to begin with a letter or an underscore. Although it is
67
legal to use uppercase letters, by convention we don't. If you do, remember
78
that case matters. <c>Bruce</c> and <c>bruce</c> are different variables.</p>
@@ -18,9 +19,11 @@
1819
<pre>76trombones = "big parade"
1920
more$ = 1000000
2021
class = "Computer Science 101"</pre>
21-
<p><c>76trombones</c> is illegal because it does not begin with a letter. <c>more$</c>
22+
<p>
23+
<c>76trombones</c> is illegal because it does not begin with a letter. <c>more$</c>
2224
is illegal because it contains an illegal character, the dollar sign. But
23-
what's wrong with <c>class</c>?</p>
25+
what's wrong with <c>class</c>?
26+
</p>
2427
<p>It turns out that <c>class</c> is one of the Python <term>keywords</term>. Keywords define
2528
the language's syntax rules and structure, and they cannot be used as variable
2629
names.
@@ -31,120 +34,120 @@ class = "Computer Science 101"</pre>
3134
<row>
3235
<cell>
3336
and
34-
</cell>
37+
</cell>
3538
<cell>
3639
as
37-
</cell>
40+
</cell>
3841
<cell>
3942
assert
40-
</cell>
43+
</cell>
4144
<cell>
4245
break
43-
</cell>
46+
</cell>
4447
<cell>
4548
class
46-
</cell>
49+
</cell>
4750
<cell>
4851
continue
49-
</cell>
52+
</cell>
5053
</row>
5154
<row>
5255
<cell>
5356
def
54-
</cell>
57+
</cell>
5558
<cell>
5659
del
57-
</cell>
60+
</cell>
5861
<cell>
5962
elif
60-
</cell>
63+
</cell>
6164
<cell>
6265
else
63-
</cell>
66+
</cell>
6467
<cell>
6568
except
66-
</cell>
69+
</cell>
6770
<cell>
6871
exec
69-
</cell>
72+
</cell>
7073
</row>
7174
<row>
7275
<cell>
7376
finally
74-
</cell>
77+
</cell>
7578
<cell>
7679
for
77-
</cell>
80+
</cell>
7881
<cell>
7982
from
80-
</cell>
83+
</cell>
8184
<cell>
8285
global
83-
</cell>
86+
</cell>
8487
<cell>
8588
if
86-
</cell>
89+
</cell>
8790
<cell>
8891
import
89-
</cell>
92+
</cell>
9093
</row>
9194
<row>
9295
<cell>
9396
in
94-
</cell>
97+
</cell>
9598
<cell>
9699
is
97-
</cell>
100+
</cell>
98101
<cell>
99102
lambda
100-
</cell>
103+
</cell>
101104
<cell>
102105
nonlocal
103-
</cell>
106+
</cell>
104107
<cell>
105108
not
106-
</cell>
109+
</cell>
107110
<cell>
108111
or
109-
</cell>
112+
</cell>
110113
</row>
111114
<row>
112115
<cell>
113116
pass
114-
</cell>
117+
</cell>
115118
<cell>
116119
raise
117-
</cell>
120+
</cell>
118121
<cell>
119122
return
120-
</cell>
123+
</cell>
121124
<cell>
122125
try
123-
</cell>
126+
</cell>
124127
<cell>
125128
while
126-
</cell>
129+
</cell>
127130
<cell>
128131
with
129-
</cell>
132+
</cell>
130133
</row>
131134
<row>
132135
<cell>
133136
yield
134-
</cell>
137+
</cell>
135138
<cell>
136139
True
137-
</cell>
140+
</cell>
138141
<cell>
139142
False
140-
</cell>
143+
</cell>
141144
<cell>
142145
None
143-
</cell>
146+
</cell>
144147
<cell>
145-
</cell>
148+
</cell>
146149
<cell>
147-
</cell>
150+
</cell>
148151
</row>
149152
</tabular>
150153
</table>
@@ -155,10 +158,10 @@ class = "Computer Science 101"</pre>
155158
remember, what the variable is used for.</p>
156159
<warning>
157160
<p>Beginners sometimes confuse <q>meaningful to the human readers</q> with
158-
<q>meaningful to the computer</q>. So they'll wrongly think that because
161+
<q>meaningful to the computer</q>. So they'll wrongly think that because
159162
they've called some variable <c>average</c> or <c>pi</c>, it will somehow
160163
automagically calculate an average, or automagically associate the variable
161-
<c>pi</c> with the value 3.14159. No! The computer doesn't attach semantic
164+
<c>pi</c> with the value 3.14159. No! The computer doesn't attach semantic
162165
meaning to your variable names.</p>
163166
<p>So you'll find some instructors who deliberately don't choose meaningful
164167
names when they teach beginners &#x2014; not because they don't think it is a
@@ -181,15 +184,15 @@ class = "Computer Science 101"</pre>
181184
</statement>
182185
<feedback>
183186
- The + character is not allowed in variable names.
184-
</feedback>
187+
</feedback>
185188
</choice>
186189
<choice correct="yes">
187190
<statement>
188191
<p>False</p>
189192
</statement>
190193
<feedback>
191194
- The + character is not allowed in variable names (everything else in this name is fine).
192-
</feedback>
195+
</feedback>
193196
</choice>
194197
</choices>
195198
</exercise>

pretext/bookinfo.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
3434

3535
<!-- Prefix to enhance Sage notebook contents -->
3636
<initialism>SB</initialism>
37-
37+
<blurb shelf="introcs">The original open source intro to computer science textbook. Great for students of all ages.</blurb>
3838
<!-- Math-related macros from "macros.tex" in previous LaTeX version -->
3939
<!-- \notdivide replaces \notmid to avoid conflict with tikz - TWJ 5/6/2010 -->
4040
<!-- Added operator \gf - TWJ 2/26/2013 -->

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
runestone>=4.0.0
2-
psycopg2-binary
1+
pretextbook >= 0.8.0

0 commit comments

Comments
 (0)