From: Steven Baltakatei Sandoval Date: Mon, 13 Feb 2023 05:34:13 +0000 (+0000) Subject: feat(src/tm-notes):Convert notes.tm into a book. Add exercise notes. X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2023-05.git/commitdiff_plain/17ea44aa6726c7765178d35ce39cd1366f74b059 feat(src/tm-notes):Convert notes.tm into a book. Add exercise notes. --- diff --git a/src/tm-notes/book.tm b/src/tm-notes/book.tm new file mode 100644 index 0000000..57c2804 --- /dev/null +++ b/src/tm-notes/book.tm @@ -0,0 +1,144 @@ + + +> + +<\body> + notes for >|||>>|> + + + + + + + + \; + + +<\initial> + <\collection> + + + + + + +<\references> + <\collection> + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + heap|7|ch1.tm>> + machine-independent|7|ch1.tm>> + operand|7|ch1.tm>> + > + > + struct|7|ch1.tm>> + > + > + > + > + > + > + > + > + operator|7|ch1.tm>> + stack|7|ch1.tm>> + text + stream|8|ch1.tm>> + + + +<\auxiliary> + <\collection> + <\associate|parts> + + + + + + + <\associate|toc> + |math-font-series||1Definitions> + |.>>>>|> + + + 1.1Terminology |.>>>>|> + + + 1.2Functions |.>>>>|> + + + |1.2.1Character Input and Output + |.>>>>|> + > + + |math-font-series||2Utilities> + |.>>>>|> + + + 2.1Text Editor |.>>>>|> + + + 2.2Linter |.>>>>|> + + + |math-font-series||3K&R + Exercises> |.>>>>|> + + + + \ No newline at end of file diff --git a/src/notes.tm b/src/tm-notes/ch1.tm similarity index 73% rename from src/notes.tm rename to src/tm-notes/ch1.tm index 30d61d8..c18aa7f 100644 --- a/src/notes.tm +++ b/src/tm-notes/ch1.tm @@ -1,16 +1,10 @@ + + > <\body> - <\hide-preamble> - \; - - - >||0>>|list*|list>|>>>|>>>>|> - > - - @@ -380,99 +374,87 @@ \; - - - - - - <\itemize> - - GNU text editor. See - . - - - text editor See . - - - - - (TODO: Insert C language linter here) - - \; <\initial> <\collection> - + <\references> <\collection> - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - heap|?>> + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + heap|3|../../../../.TeXmacs/texts/scratch/no_name_10.tm>> machine-independent|?>> - operand|?>> - > - > - struct|?>> - > - > - > - > - > - > - > - > - operator|?>> - stack|?>> - text stream|?>> + machine-independent>machine-independent|3|../../../../.TeXmacs/texts/scratch/no_name_10.tm>> + operand|3|../../../../.TeXmacs/texts/scratch/no_name_10.tm>> + > + > + struct|3|../../../../.TeXmacs/texts/scratch/no_name_10.tm>> + > + > + > + > + > + > + > + > + operator|3|../../../../.TeXmacs/texts/scratch/no_name_10.tm>> + stack|3|../../../../.TeXmacs/texts/scratch/no_name_10.tm>> + text + stream|4|../../../../.TeXmacs/texts/scratch/no_name_10.tm>> @@ -492,16 +474,6 @@ |1.2.1Character Input and Output |.>>>>|> > - - |math-font-series||2Utilities> - |.>>>>|> - - - 2.1Text Editor |.>>>>|> - - - 2.2Linter |.>>>>|> - \ No newline at end of file diff --git a/src/tm-notes/ch2.tm b/src/tm-notes/ch2.tm new file mode 100644 index 0000000..1492ff0 --- /dev/null +++ b/src/tm-notes/ch2.tm @@ -0,0 +1,52 @@ + + + + +> + +<\body> + + + + + <\itemize> + - GNU text editor. See + . + + - text editor See . + + + + + (TODO: Insert C language linter here) + + +<\initial> + <\collection> + + + + +<\references> + <\collection> + > + > + > + + + +<\auxiliary> + <\collection> + <\associate|toc> + |math-font-series||1Utilities> + |.>>>>|> + + + 1.1Text Editor |.>>>>|> + + + 1.2Linter |.>>>>|> + + + + \ No newline at end of file diff --git a/src/tm-notes/ch3.tm b/src/tm-notes/ch3.tm new file mode 100644 index 0000000..2249160 --- /dev/null +++ b/src/tm-notes/ch3.tm @@ -0,0 +1,290 @@ + + + + +> + +<\body> + + + + + + + \; + + <\description> + Run the \P\Q program on your + system. Experiment with leaving out parts of the program, to see what + error messages you get. + + Experiment to find out what happens when + 's argument string contains , where is + some character not listed above. + + + + + <\description> + Modify the temperature conversion program to bring a + heading above the table. + + Write a program to bring the corresponding Celsius to + Fahrenheit table. + + + + + <\description> + Modify the temperature conversion program to print + the table in reverse order, that is, from degrees to . + + + + + + + + + <\description> + Verify that the expression is + or . + + Write a program to print the value of . + + + + + + + <\description> + Write a program to count blanks, tabs, and newlines. + + Write a program to copy its input to its output, + replacing each string of one or more blanks by a single blank. + + Write a program to copy its input to its output, + replacing each tab by , each backspace by , and each + backslash by . This makes tabs and backspaces visible in an + unambiguous way. + + + + + <\description> + How would you test the word program? What kinds of + input are most likely to uncover bugs if there are any? + + Write a program that prints its input one word per + line. + + + + + <\description> + Write a program to print a histogram of the lengths + of words in its input. IT is easy to draw the histogram with the bars + horizontal; a vertical orientation is more challenging. + + Write a program to print a histogram of the + frequencies of different characters in its input. + + + + + <\description> + Rewrite the temperature conversion program of + Section 1.2 to use a function for conversion. + + + + + + + <\description> + Revise the main routine of the longest-line program + so it will correctly print the length of arbitrarily long input lines, + and as much as possible of the text. + + Write a program to print all input lines that are + longer than characters. + + Write a program to remove trailing blanks and tabs + from each line of input, and to delete entirely blank lines. + + Write a function that reverses the + character string . Use it to write a program that reverses its + input a line at a time. + + + + + <\description> + Write a program that replaces tabs in + the input with the proper number of blanks to space to the next tab stop. + Assume a fixed set of tab stops, say every columns. Should + be a variable or a symbolic parameter? + + Write a program that replaces strings of + blanks by the minimum number of tabs and blanks to achieve the same + spacing. Use the same tab stops as for . When either a tab or + a single blank would suffice to each a tab stop, which should be given + preference? + + Write a program to \Pfold\Q long input lines into + two or more shorter lines after the last non-blank character that occurs + before the -th column of input. Make sure your program does + something intelligent with very long lines, and if there are no blanks or + tabs before the specified column. + + Write a program to remove all comments from a + program. Don't forget to handle quoted strings and character + constants properly. comments do not nest. + + Write a program to check a program for + rudimentary syntax errors like unbalanced parentheses, brackets and + braces. Don't forget about quotes, both single and double, escape + sequences, and comments. (This program is hard if you do it in full + generality.) + + + + + + + + + <\description> + Write a program to determine the ranges of + , , , and variables, both + and , by printing appropriate values from + standard headers and by direct computation. Harder if you compute them: + determine the ranges of the various floating-point types. + + + + + + + + + + + <\description> + Write a loop equivalent to the loop above + without using or . + + + + + <\description> + Write the function , which converts a + string of hexadecimal digits (including an optional or ) + into its equivalent integer value. The allowable digits are + through , through , and through . + + + + + <\description> + Write an alternate version of + that deletes each character in that matches any character in the + . + + Write the function , which returns + the first location in the string where any character fromt he + string occurs, or if contains no characters + from . (The standard library function does the same + job but returns a pointer to the location.) + + + + + <\description> + Write a function that returns + with the bits that begin at position set to the + rightmost bits of , leaving the other bits unchanged. + + Write a function that returns + with the bits that begin at position inverted + (i.e. changed into and vice versa), leaving the others + unchanged. + + Write a function that returns the + value of the integer rotated to the right by bit + positions. + + + + + <\description> + In a two\<#2019\>s complement number system, deletes the rightmost -bit in . Explain why. Use + this observation to write a faster version of . + + + + + <\description> + Rewrite the function , which converts + upper case letters to lower case, with a conditional expression instead + of . + + + + + \; + + \; + + +<\initial> + <\collection> + + + + +<\references> + <\collection> + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + + + +<\auxiliary> + <\collection> + <\associate|toc> + |math-font-series||1K&R + Exercises> |.>>>>|> + + + + \ No newline at end of file diff --git a/src/style-bk.ts b/src/tm-notes/style-bk.ts similarity index 100% rename from src/style-bk.ts rename to src/tm-notes/style-bk.ts