Ch 1 - The Way of the Program Flashcards
Think Julia
What are the two types of syntax rules?
Syntax rules come in two flavors: tokens and structure.
Tokens are the basic elements of the language, such as words, numbers, and chemical elements. One of the problems with 3 + = 3 $ 6 is that $ is not a legal token in mathematics (at least as far as I know). Similarly, 2 Zz is not legal because there is no element with the abbreviation Zz .
The second type of syntax rule pertains to the way tokens are combined. The equation 3 + = 3 is illegal because even though + and = are legal tokens, you can’t have one right after the other. Similarly, in a chemical formula the subscript comes after the element name, not before.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 287-293). Kindle Edition.
Think Julia
What is a token?
Syntax rules come in two flavors: tokens and structure.
Tokens are the basic elements of the language, such as words, numbers, and chemical elements. One of the problems with 3 + = 3 $ 6 is that $ is not a legal token in mathematics (at least as far as I know). Similarly, 2 Zz is not legal because there is no element with the abbreviation Zz .
The second type of syntax rule pertains to the way tokens are combined. The equation 3 + = 3 is illegal because even though + and = are legal tokens, you can’t have one right after the other. Similarly, in a chemical formula the subscript comes after the element name, not before.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 287-293). Kindle Edition.
Think Julia
What is syntax structure?
**Syntax rules come in two flavors: tokens and structure.
Tokens are the basic elements of the language, such as words, numbers, and chemical elements. One of the problems with 3 + = 3 $ 6 is that $ is not a legal token in mathematics (at least as far as I know). Similarly, 2 Zz is not legal because there is no element with the abbreviation Zz .
The second type of syntax rule pertains to the way tokens are combined. The equation 3 + = 3 is illegal because even though + and = are legal tokens, you can’t have one right after the other. Similarly, in a chemical formula the subscript comes after the element name, not before.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 287-293). Kindle Edition. **
Think Julia
What is parsing?
When you read a sentence in English or a statement in a formal language, you have to figure out the structure (although in a natural language you do this subconsciously). This process is called parsing.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 294-296). Kindle Edition.
Think Julia
What is: REPL
REPL
A program that repeatedly reads input, executes it, and outputs results.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 335-337). Kindle Edition.
Think Julia
What is: operator
operator
A symbol that represents a simple computation like addition, multiplication, or string concatenation.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 342-343). Kindle Edition.
Think Julia
What is: type
Type:
A category of values. The types we have seen so far are integers (Int64), floating-point numbers (Float64), and strings (String).
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 346-348). Kindle Edition.
Think Julia
What is: value
value
A basic unit of data, like a number or string, that a program manipulates.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 344-345). Kindle Edition.
Think Julia
What is: syntax
syntax
The rules that govern the structure of a program.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 357-359). Kindle Edition.
Think Julia
What is: token
token
One of the basic elements of the syntactic structure of a program, analogous to a word in a natural language.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 359-361). Kindle Edition.
Think Julia
What is: structure
Structure
The way tokens are combined.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 361-362). Kindle Edition.
Think Julia
What is: parse
parse
To examine a program and analyze the syntactic structure.
Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 362-363). Kindle Edition.