2019-05-30T20:42:31

Zen and the Forth Language

Here are my notes from book Zen and the Forth Language by Dr. Chen-Hanson Ting.

cover
  • p12 Software engineers and firmware engineers throw away the words they used to build target systems, because these words are not needed by the end users, who are generally assumed to be monkeys who can only push keys and click mouse. Users do not need knowledge on how the products was constructed. However, if you are a user of your program, you want to keep the names as long as you are using it. You might have to go back to some words to find bugs if the program had trouble. Were the words properly preserved in the product, you would have a much easier time to find bugs and fix them.
  • p18 Bill Muench identified 31 commands which had to be written in machine instructions of a target microcontroller, and the rest of 223 commands written in high level Forth code could be ported without modifications.
  • p40 The possibilities is enormous. I can only lead you to the water. You have to do the drinking yourself.
  • p45 Forth allows you to reach the registers and the bits in them. Spend time meditating on them. A microcontroller understands only these bits and registers. After tinkling these bits in registers, you will learn how to make them to work as you wish.
  • p202 In 1957, Fortran was developed to ease programming efforts, and it became hugely successful. However, Fortran was the wrong programming language for computers in general. It gets computers to do algebra instead of arithmetic, which computers do naturally, as all computers have ALU, Arithmetic/Logic Unit, in them. Most high level programming languages followed Fortran closely, including C, using algebraic equations as the elementary construct in programs. Since algebra is not natural to computes, algebraic equations have to be translated or compiled into arithmetic expressions that computers can work on. As far as mathematics is concernec, Forth is an arithmetic and logic language, and it does not need complicated compilers to translate algebraic equations. All arithmetic and logic operations are done in a left to right sequence. No artificial parentheses and rules of precedence are necessary. Actually, the left to right execution sequence applies equally well to almost all other types of operations. Forth is thus closer to a natural language than all other languages, programming languages and linguistic languages, which always require syntax rules and grammatical constructs to clarify the intentions of the speaker. The left to right interpretation of command lists, and the capability to name a list to become a new command is the natural way we human thinks, communicates, and to develop intelligence.
  • p205 Like all other microcontrollers and for that matter, all other computers, MSP430G2553 chip was designed by groups of engineers who did not understand microcontrollers, and how they were to be used. They managed to squeeze lots of devices and features into a small chip. They then threw the chip over a wall to the software engineers, who built assemblers, compilers and debugging tools. They dumped this huge tool chain in your lap, and hope that you can build something useful out of the whole mess.
  • p206 As a lifelong teacher, I really enjoy microcontrollers as students. Most students generally did not remember what you taught them in classes, after the final examination. Then, you would appreciate a student whi actually remembers something you taught him. Microcontrollers are my best students, because they have perfect memory, and they remembered everything I taught them, right or wrong.