libmya 0.1.0
Library to parse Mya language.
Loading...
Searching...
No Matches
globals.c
Go to the documentation of this file.
1#include <stdlib.h>
2
3#include "types/ast.h"
4#include "types/keywords.h"
5#include "types/operators.h"
6#include "version.h"
7
8const char* mya_version = VERSION;
9
10const char* mya_keywords[] = {
11 [KEY_BITFIELD] = "bitfield",
12 // clang-format hates me.
13 [KEY_IMMEDIATE] = "immediate",
14 [KEY_INCLUDE] = "include",
15 [KEY_INST] = "inst",
16 [KEY_REGISTER] = "register",
17 [KEY_SET] = "set",
18 NULL,
19};
20
21const char* mya_operators[] = {
22 [OP_AND] = "&",
23 // clang-format hates me.
24 [OP_DIV] = "/",
25 [OP_MINUS] = "-",
26 [OP_MULT] = "*",
27 [OP_NOT] = "~",
28 [OP_OR] = "|",
29 [OP_PLUS] = "+",
30 [OP_SHIFT_LEFT] = "<<",
31 [OP_SHIFT_RIGHT] = ">>",
32 [OP_XOR] = "^",
33 NULL,
34};
35
36const char* mya_token_types[] = {
37 [TK_CLOSE_BRACES] = "close_braces",
38 // clang-format hates me.
39 [TK_CLOSE_BRACKET] = "close_bracket",
40 [TK_CLOSE_PARENS] = "close_parentheses",
41 [TK_COLON] = "colon",
42 [TK_COMMA] = "comma",
43 [TK_EOF] = "end_of_file",
44 [TK_EQUAL] = "equal",
45 [TK_IDENTIFIER] = "identifier",
46 [TK_KEYWORD] = "keyword",
47 [TK_NUMBER] = "number",
48 [TK_OPEN_BRACES] = "open_braces",
49 [TK_OPEN_BRACKET] = "open_bracket",
50 [TK_OPEN_PARENS] = "open_parentheses",
51 [TK_OPERATOR] = "operator",
52 [TK_SEMICOLON] = "semicolon",
53 [TK_STRING] = "string",
54 NULL,
55};
56
57const char* mya_node_types[] = {
58 [NT_ARG_LIST] = "argument_list",
59 // clang-format hates me.
60 [NT_BITFIELD_BODY] = "bitfield_body",
61 [NT_EXPRESSION] = "expression",
62 [NT_IDENTIFIER] = "identifier",
63 [NT_INST_BODY] = "inst_body",
64 [NT_ROOT] = "root",
65 [NT_SIZE_SPEC] = "size_spec",
66 [NT_STATEMENT] = "statement",
67 [NT_STRING] = "string",
68 [NT_TYPE] = "type_name",
69 NULL,
70};
const char * mya_version
Definition globals.c:8
const char * mya_node_types[]
Definition globals.c:57
const char * mya_operators[]
Definition globals.c:21
const char * mya_token_types[]
Definition globals.c:36
const char * mya_keywords[]
Definition globals.c:10
@ KEY_INST
Definition keywords.h:8
@ KEY_IMMEDIATE
Definition keywords.h:6
@ KEY_SET
Definition keywords.h:10
@ KEY_BITFIELD
Definition keywords.h:5
@ KEY_REGISTER
Definition keywords.h:9
@ KEY_INCLUDE
Definition keywords.h:7
@ OP_SHIFT_LEFT
Definition operators.h:12
@ OP_NOT
Definition operators.h:9
@ OP_SHIFT_RIGHT
Definition operators.h:13
@ OP_PLUS
Definition operators.h:11
@ OP_DIV
Definition operators.h:6
@ OP_XOR
Definition operators.h:14
@ OP_MULT
Definition operators.h:8
@ OP_AND
Definition operators.h:5
@ OP_MINUS
Definition operators.h:7
@ OP_OR
Definition operators.h:10
@ NT_STRING
Definition ast.h:18
@ NT_TYPE
Definition ast.h:19
@ NT_SIZE_SPEC
Definition ast.h:16
@ NT_INST_BODY
Definition ast.h:14
@ NT_IDENTIFIER
Definition ast.h:13
@ NT_STATEMENT
Definition ast.h:17
@ NT_EXPRESSION
Definition ast.h:12
@ NT_ROOT
Definition ast.h:15
@ NT_ARG_LIST
Definition ast.h:10
@ NT_BITFIELD_BODY
Definition ast.h:11
@ TK_OPEN_BRACKET
Definition token.h:21
@ TK_NUMBER
Definition token.h:19
@ TK_STRING
Definition token.h:25
@ TK_IDENTIFIER
Definition token.h:17
@ TK_COLON
Definition token.h:13
@ TK_OPEN_BRACES
Definition token.h:20
@ TK_OPEN_PARENS
Definition token.h:22
@ TK_COMMA
Definition token.h:14
@ TK_CLOSE_PARENS
Definition token.h:12
@ TK_KEYWORD
Definition token.h:18
@ TK_OPERATOR
Definition token.h:23
@ TK_CLOSE_BRACKET
Definition token.h:11
@ TK_EOF
Definition token.h:15
@ TK_CLOSE_BRACES
Definition token.h:10
@ TK_EQUAL
Definition token.h:16
@ TK_SEMICOLON
Definition token.h:24
#define VERSION
Definition version.h:3