@elwood-lang/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast.d.ts +237 -0
- package/dist/ast.d.ts.map +1 -0
- package/dist/ast.js +2 -0
- package/dist/ast.js.map +1 -0
- package/dist/evaluator.d.ts +4 -0
- package/dist/evaluator.d.ts.map +1 -0
- package/dist/evaluator.js +879 -0
- package/dist/evaluator.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/lexer.d.ts +14 -0
- package/dist/lexer.d.ts.map +1 -0
- package/dist/lexer.js +279 -0
- package/dist/lexer.js.map +1 -0
- package/dist/parser.d.ts +15 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +610 -0
- package/dist/parser.js.map +1 -0
- package/dist/scope.d.ts +13 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +27 -0
- package/dist/scope.js.map +1 -0
- package/dist/token.d.ts +65 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +66 -0
- package/dist/token.js.map +1 -0
- package/package.json +36 -0
- package/src/ast.ts +235 -0
- package/src/evaluator.ts +832 -0
- package/src/index.ts +78 -0
- package/src/lexer.ts +300 -0
- package/src/parser.ts +626 -0
- package/src/scope.ts +26 -0
- package/src/token.ts +87 -0
package/src/token.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export enum TokenKind {
|
|
2
|
+
// Literals
|
|
3
|
+
StringLiteral = 'StringLiteral',
|
|
4
|
+
NumberLiteral = 'NumberLiteral',
|
|
5
|
+
TrueLiteral = 'TrueLiteral',
|
|
6
|
+
FalseLiteral = 'FalseLiteral',
|
|
7
|
+
NullLiteral = 'NullLiteral',
|
|
8
|
+
|
|
9
|
+
// Identifiers & paths
|
|
10
|
+
Identifier = 'Identifier',
|
|
11
|
+
Dollar = 'Dollar',
|
|
12
|
+
DollarDot = 'DollarDot',
|
|
13
|
+
Dot = 'Dot',
|
|
14
|
+
DotDot = 'DotDot',
|
|
15
|
+
|
|
16
|
+
// Brackets
|
|
17
|
+
LeftBracket = 'LeftBracket',
|
|
18
|
+
RightBracket = 'RightBracket',
|
|
19
|
+
LeftParen = 'LeftParen',
|
|
20
|
+
RightParen = 'RightParen',
|
|
21
|
+
LeftBrace = 'LeftBrace',
|
|
22
|
+
RightBrace = 'RightBrace',
|
|
23
|
+
|
|
24
|
+
// Operators
|
|
25
|
+
Pipe = 'Pipe',
|
|
26
|
+
FatArrow = 'FatArrow',
|
|
27
|
+
Comma = 'Comma',
|
|
28
|
+
Colon = 'Colon',
|
|
29
|
+
Star = 'Star',
|
|
30
|
+
Spread = 'Spread',
|
|
31
|
+
|
|
32
|
+
// Arithmetic
|
|
33
|
+
Plus = 'Plus',
|
|
34
|
+
Minus = 'Minus',
|
|
35
|
+
Slash = 'Slash',
|
|
36
|
+
|
|
37
|
+
// Assignment
|
|
38
|
+
Assign = 'Assign',
|
|
39
|
+
|
|
40
|
+
// Comparison
|
|
41
|
+
EqualEqual = 'EqualEqual',
|
|
42
|
+
BangEqual = 'BangEqual',
|
|
43
|
+
LessThan = 'LessThan',
|
|
44
|
+
LessThanOrEqual = 'LessThanOrEqual',
|
|
45
|
+
GreaterThan = 'GreaterThan',
|
|
46
|
+
GreaterThanOrEqual = 'GreaterThanOrEqual',
|
|
47
|
+
|
|
48
|
+
// Logical
|
|
49
|
+
AmpersandAmpersand = 'AmpersandAmpersand',
|
|
50
|
+
PipePipe = 'PipePipe',
|
|
51
|
+
Bang = 'Bang',
|
|
52
|
+
|
|
53
|
+
// Keywords
|
|
54
|
+
Let = 'Let',
|
|
55
|
+
If = 'If',
|
|
56
|
+
Then = 'Then',
|
|
57
|
+
Else = 'Else',
|
|
58
|
+
Match = 'Match',
|
|
59
|
+
Return = 'Return',
|
|
60
|
+
From = 'From',
|
|
61
|
+
Asc = 'Asc',
|
|
62
|
+
Desc = 'Desc',
|
|
63
|
+
On = 'On',
|
|
64
|
+
Equals = 'Equals',
|
|
65
|
+
Into = 'Into',
|
|
66
|
+
Underscore = 'Underscore',
|
|
67
|
+
Memo = 'Memo',
|
|
68
|
+
|
|
69
|
+
// Interpolation
|
|
70
|
+
Backtick = 'Backtick',
|
|
71
|
+
|
|
72
|
+
// Special
|
|
73
|
+
Eof = 'Eof',
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface SourceSpan {
|
|
77
|
+
start: number;
|
|
78
|
+
end: number;
|
|
79
|
+
line: number;
|
|
80
|
+
column: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface Token {
|
|
84
|
+
kind: TokenKind;
|
|
85
|
+
text: string;
|
|
86
|
+
span: SourceSpan;
|
|
87
|
+
}
|