Files
corelang/output.cc
2022-05-01 13:51:34 +02:00

143 lines
1.7 KiB
C++

(4+(2*53))
Error: Expected token of kind: ), got instead token of kind: End of stream
((4+2)*53)
(++5)
(--5)
(-5)
(+5)
(()5)
((()5)+3)
((534>43)?435:42)
(((534>43)?435:42),234,(()42),Thing[10][2],Thing(1,2))
typedef struct String String;
struct String{
U8 *str;
S64 len;
};
typedef Intern_String;
enum Token_Kind{
End,
Mul,
Div,
Add,
Sub,
Mod,
BitAnd,
BitOr,
BitXor,
Neg,
Not,
OpenParen,
CloseParen,
OpenBrace,
CloseBrace,
OpenBracket,
CloseBracket,
Comma,
Pound,
Question,
ThreeDots,
Semicolon,
Dot,
LesserThen,
GreaterThen,
Colon,
Assign,
DivAssign,
MulAssign,
ModAssign,
SubAssign,
AddAssign,
AndAssign,
OrAssign,
XorAssign,
LeftShiftAssign,
RightShiftAssign,
DoubleColon,
At,
Decrement,
Increment,
PostDecrement,
PostIncrement,
LesserThenOrEqual,
GreaterThenOrEqual,
Equals,
And,
Or,
NotEquals,
LeftShift,
RightShift,
Arrow,
ExprSizeof,
DocComment,
Comment,
Identifier,
StringLit,
U8Lit,
Character,
Error,
Float,
Int,
Keyword,
}
typedef struct Token Token;
struct Token{
Token_Kind kind;
union {
String string;
struct {
U8 *str;
U64 len;
};
};
union {
S64 int_val;
String error_val;
String intern_val;
};
String file;
S64 line;
U8 *line_begin;
};
enum AST_Kind{
BaseType,
Typedef,
Enum,
Struct,
Union,
Note,
List,
Pointer,
Array,
Function,
Variable,
EnumChild,
}
typedef struct AST_Node AST_Node;
struct AST_Node{
AST_Kind kind;
AST_Node node[16];
AST_Node *next;
AST_Node *next_scope;
AST_Node *first_note;
AST_Node *last_note;
AST_Node *first_child;
AST_Node *last_child;
union {
SizeU base_type_size;
AST_Node *pointer;
AST_Node *typedef_type;
AST_Node *variable_type;
AST_Node *func_return_type;
};
};