-
Notifications
You must be signed in to change notification settings - Fork 0
/
math-expressions-outline.txt
72 lines (47 loc) · 4.17 KB
/
math-expressions-outline.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#####################
Tokenization Basics
#####################
- Input Text
|
v
- Lexeme
| The most basic unit of a math expression. Lexemes usually correspond to one or two characters in total.
v Examples of lexemes include digits, letters, symbols (+-*/%), brackets (both open/close), etc.
- Primitive Token
| Simple tokens that
v
- Token
[LEXEME TKZ: STAGE 1]-----------------------------------------------------------------------------------------------------------
bracket bracket bracket alpha alpha bracket
LEXEMES: open digit divide digit close multiply close digit | digit subtract digit|digit close
v v v v v v v \ | _/\_ v \ | /\ v
\ | / \ \ |/ \
( 1 / 5 ) * ( 0b10100101 - 0xFaFo )
\ ^ /
\________________________________________/|\__________________________________________________________/
|
PRIMITIVE TOKENS: expression
|
[LEXEME TKZ: STAGE 2]-----------------------------------V-----------------------------------------------------------------------
bracket bracket bracket alpha alpha bracket
LEXEMES: open digit divide digit close multiply close digit | digit subtract digit|digit close
v v v v v v v \ | _/\_ v \ | /\ v
\ | / \ \ |/ \
( 1 / 5 ) * ( 0b10100101 - 0xFaFo )
\ ^ / ^ \ ^ /
\_____________/|\_____________/ | \_________________________/|\___________________/
| | |
PRIMITIVE TOKENS: expression [ multiplication operator ] expression
| | |
[LEXEME TKZ: STAGE ...]----[...]----------------------[...]----------------------------------[...]------------------------------
(Stage # may differ) | | |
[PRIMITIVE TKZ: STAGE 1]-----V--------------------------V--------------------------------------V--------------------------------
| | |
PRIMITIVE TOKENS: expression [ multiplication operator ] expression
| | |
v v v
( 1 / 5 ) * ( 0b10100101 - 0xFaFo )
TOKENS: ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
expression decimal division deci. bracket mult. expression binary number subtract hexadecimal bracket
start number operator number close operator start operator number close
[PRIMITIVE TKZ: STAGE ...]------------------------------------------------------------------------------------------------------