Ch 1 - The Way of the Program Flashcards

1
Q

Think Julia

What are the two types of syntax rules?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Think Julia

What is a token?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Think Julia

What is syntax structure?

A

**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. **

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Think Julia

What is parsing?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Think Julia

What is: REPL

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Think Julia

What is: operator

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Think Julia

What is: type

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Think Julia

What is: value

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Think Julia

What is: syntax

A

syntax

The rules that govern the structure of a program.

Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 357-359). Kindle Edition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Think Julia

What is: token

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Think Julia

What is: structure

A

Structure

The way tokens are combined.

Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 361-362). Kindle Edition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Think Julia

What is: parse

A

parse

To examine a program and analyze the syntactic structure.

Ben Lauwens and Allen B. Downey. thinkjulia (Kindle Locations 362-363). Kindle Edition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly