Skip to content

Conversation

@martin-henz
Copy link
Member

No description provided.

@martin-henz martin-henz changed the title ch5 INDEX work in chapter 5 Apr 24, 2021
@martin-henz martin-henz marked this pull request as draft April 24, 2021 18:53
@martin-henz martin-henz marked this pull request as ready for review April 25, 2021 06:27
@martin-henz
Copy link
Member Author

martin-henz commented Apr 25, 2021

Substantial changes:

25/4/2021: 5.4.1 near end: removed newline before
"ev_sequence_empty",
go_to(reg("continue")),
There may be some reasoning behind the newline, but I think it looks better without the newline.

25/4/2021: 5.3.1 added is_boolean and is_undefined to the list of is_ functions just before heading “Implementing Stacks”. This is for completeness, to have consistent index entries for these predicates.

25/4/2021: 5.3.1 handling of strings: we forgot that +, stringify, char_at etc create new strings at runtime. Also note the established term for this: string pool.

A string might be represented as a typed pointer that designates a sequence of the characters that form the string<APOS/>s printed representation. This sequence is constructed by the JavaScript parser when the character string is initially encountered in input. Since we want two instances of a string to be recognized as the <QUOTE>same</QUOTE> string by <JAVASCRIPTINLINE>===</JAVASCRIPTINLINE> and we want <JAVASCRIPTINLINE>===</JAVASCRIPTINLINE> to be a simple test for equality of pointers, we must ensure that if the parser sees the same character string twice, it will use the same pointer (to the same sequence of characters) to represent both occurrences. To accomplish this, the parser maintains a table of all the strings it has ever encountered. When the parser encounters a character string and is about to construct a string, it checks the table to see if it has ever before seen the same character string. If it has not, it uses the characters to construct a new string (a typed pointer to a new character sequence) and enters this pointer in the table. If the parser has seen the string before, it returns the string pointer stored in the table. This process of replacing character strings by unique pointers is called <EM>interning</EM> strings. 

A string might be represented as a typed pointer that designates a sequence of the characters that form the string<APOS/>s printed representation. The JavaScript parser constructs such a sequence when it initially encounters a string as a string literal, and the string-producing concatenation operator <JAVASCRIPTINLINE>+</JAVASCRIPTINLINE> and string-producing primitive functions such as <JAVASCRIPTINLINE>stringify</JAVASCRIPTINLINE> and <JAVASCRIPTINLINE>char_at</JAVASCRIPTINLINE> construct such a sequence when they return a new string. Since we want two instances of a string to be recognized as the <QUOTE>same</QUOTE> string by <JAVASCRIPTINLINE>===</JAVASCRIPTINLINE> and we want <JAVASCRIPTINLINE>===</JAVASCRIPTINLINE> to be a simple test for equality of pointers, we must ensure that if the machine sees the same string twice, it will use the same pointer (to the same sequence of characters) to represent both occurrences. To accomplish this, the machine maintains a table, called the <EM>string pool</EM>, of all the strings it has ever encountered. When the machine encounters a string, it checks the string pool to see if it has ever before seen the same string. If it has not, it uses the string<APOS/>s characters to construct a new string (a typed pointer to a new character sequence) and enters this pointer in the string pool. If the machine has seen the string before, it returns the string pointer stored in the string pool. This process of replacing strings by unique pointers is called <EM>string interning</EM>. 

25/4/2021: 5.1.1: print => display
Instead of having the machine stop after printing
the answer, we have made it start over, so that it repeatedly
reads a pair of numbers, computes their GCD, and prints
the result.

Instead of having the machine stop after displaying
the answer, we have made it start over, so that it repeatedly
reads a pair of numbers, computes their GCD, and displays
the result.

25/4/2021: 5.5.3, footnote 47: move closer to original: Rationale: If “compilers not always” do this, a programmer cannot rely on recursion for representing iterative processes, so the conclusion is still valid, even for a weaker premise.
However, most compilers for common languages, including C, cannot always do this, and as a result cannot always represent iterative processes in terms of function call alone.

However, compilers for common languages, including C and C++, do not always do this, and therefore these languages cannot represent iterative processes in terms of function call alone.

24/4/2021: 5.4.3, exercise on while loops: rephrased
You may cheat and assume that the syntax transformer

You may cheat by assuming that the syntax transformer

24/4/2021: 5.4.3, exercise on while loops: removed “then”
You can then paste the declaration of the function

You can paste the declaration of the function

24/4/2021: 5.4.3, subheading “Blocks“: Removed footnote. Rationale: This footnote doesn’t make sense, in multiple ways, in my view.

Scanning out declarations should be a syntax transformation,
like operator_combination_to_application.
See footnote in
section.

Copy link
Collaborator

@TobiasWrigstad TobiasWrigstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. There may be one INDEX placement that needs tweaking once I've rebased the mit branch, but I'll deal with that in that case.

All content edits good. We need to alert Julie to these, ofc.

@TobiasWrigstad TobiasWrigstad merged commit 228c154 into master Apr 28, 2021
TobiasWrigstad pushed a commit that referenced this pull request Apr 28, 2021
* ch5 * fragile * up to 5.2 * ch5 index work done * minor fix * latest from references * minor fix * colmerauer fixed * SPACE more portable
TobiasWrigstad added a commit that referenced this pull request Apr 30, 2021
ALLOW_BREAK Added FIXED_SPACE Added missing blockquote Adjustments see email Alignment Arrows pointing to code Better spacing for lists in exercises + new Quote env that preserves Capping the figure widths at textwidth, adjusting scaling Chapter heads and links Code formatting Dealing with space issues in footnotes Dedication and epigraph EQNARRAY => ALIGN in Chapter 1 Exercise heading regression Figure 5.17 on 2 pages; Figure 5.18 on 1 Figures in exercises now float (Fixes #419) Fixed broken exercise references Fixed index problem Fixed unbreakable code output Fixes #451 Fixes #459 Fixes #464 Fixing META, JAVASCRIPTINLINE, LATEXINLINE Fixing sizes, tableofcontents and headings Font changes Font size Format issue Formatting changes driven by MIT press build Formula placement Found footnotesize bug Header sizes Hopefully fixed all merge errors inside SVG files INDEX work in chapter 5 (#466) Improved formatting, moved to geometry Index proofreading preparation JS format Julie review exercise 5.47 Keep option 5 added for Exercises Linux Biolinum O => Times List of exercises DONE Lost exercise 5.38 Lots of tiny changes + use fancyhdr for headings Many many formatting edits Many small things Minor issues Moving arrows Multiple minor edits: fontsize tweaks; spacing between footnotes; etc. New font sizes No indent of enumerated list labels following request from Julie No line page break in protected snippets No slanting of strings Not quite there yet on the page width POSTPADDING Ch 4 Page headers on float pages formatted the same as rest Postpadding and some eqnarray* => align* Protecting snippets against page breaks Quotation dash Really wierd moving argument bug References handled as proper list with correct leading Replaced exercise package (and many more small things) Restoring size hacks SPACE more portable Spacing between references Trimming in index entries WIP List of Exercises \raggedbottom Font size Julie review exercise 5.47 Lost exercise 5.38 Minor issues
@RichDom2185 RichDom2185 deleted the indch5 branch July 7, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants