Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Compiler_Operator.H
Go to the documentation of this file.
1/*
2 Aleph_w
3
4 Data structures & Algorithms
5 version 2.0.0b
6 https://github.com/lrleon/Aleph-w
7
8 This file is part of Aleph-w library
9
10 Copyright (c) 2002-2026 Leandro Rabindranath Leon
11
12 Permission is hereby granted, free of charge, to any person obtaining a copy
13 of this software and associated documentation files (the "Software"), to deal
14 in the Software without restriction, including without limitation the rights
15 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 copies of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
18
19 The above copyright notice and this permission notice shall be included in all
20 copies or substantial portions of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 SOFTWARE.
29*/
30
42#ifndef COMPILER_OPERATOR_H
43#define COMPILER_OPERATOR_H
44
45#include <Compiler_Token.H>
46
47namespace Aleph {
50{
51 Invalid,
52 Assign,
53 Plus,
54 Minus,
55 Star,
56 Slash,
57 Percent,
58 EqEq,
59 NotEq,
60 Less,
61 LessEq,
62 Greater,
64 AndAnd,
65 OrOr,
66 Bang,
67 Amp,
68 Pipe,
69 Caret,
70 Tilde,
71 PlusEq,
72 MinusEq,
73 StarEq,
74 SlashEq,
78};
79
81inline const char *compiler_operator_name(const Compiler_Operator_Kind kind) noexcept
82{
83 switch (kind)
84 {
86 return "Invalid";
88 return "Assign";
90 return "Plus";
92 return "Minus";
94 return "Star";
96 return "Slash";
98 return "Percent";
100 return "EqEq";
102 return "NotEq";
104 return "Less";
106 return "LessEq";
108 return "Greater";
110 return "GreaterEq";
112 return "AndAnd";
114 return "OrOr";
116 return "Bang";
118 return "Amp";
120 return "Pipe";
122 return "Caret";
124 return "Tilde";
126 return "PlusEq";
128 return "MinusEq";
130 return "StarEq";
132 return "SlashEq";
134 return "PercentEq";
136 return "PlusPlus";
138 return "MinusMinus";
139 }
140
141 return "Invalid";
142}
143
146{
147 switch (kind)
148 {
201 default:
202 break;
203 }
204
206}
207
210{
211 switch (kind)
212 {
265 default:
266 break;
267 }
268
270}
271
274{
275 switch (kind)
276 {
282 return true;
283 default:
284 break;
285 }
286
287 return false;
288}
289
311} // namespace Aleph
312
313#endif
Token model and parser-facing metadata for compiler front-ends.
Main namespace for Aleph-w library functions.
Definition ah-arena.H:89
@ Invalid
Uninitialized register/slot or explicit invalid placeholder.
const char * compiler_operator_name(const Compiler_Operator_Kind kind) noexcept
Returns a stable debug name for one operator kind.
Compiler_Token_Kind compiler_operator_to_token_kind(const Compiler_Operator_Kind kind) noexcept
Maps one reusable operator kind back into the MVP token kind.
Compiler_Token_Kind
Token kinds supported by the compiler MVP.
@ Invalid
Sentinel for lexer errors or uninitialized tokens.
Compiler_Operator_Kind compiler_operator_compound_base(const Compiler_Operator_Kind kind) noexcept
Returns the arithmetic operator underlying one compound assignment.
bool compiler_operator_is_compound_assignment(const Compiler_Operator_Kind kind) noexcept
Returns whether kind is one compound-assignment operator.
Compiler_Operator_Kind compiler_operator_from_token_kind(const Compiler_Token_Kind kind) noexcept
Maps one reference-frontend token kind into a reusable operator kind.
Compiler_Operator_Kind
Stable operator kinds shared by reusable compiler layers.