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/mir.h"
6#include "types/operators.h"
7#include "version.h"
8
10
11const char* mya_keywords[] = {
12 [KEY_BITFIELD] = "bitfield",
13 // clang-format hates me.
14 [KEY_IMMEDIATE] = "immediate",
15 [KEY_INCLUDE] = "include",
16 [KEY_INST] = "inst",
17 [KEY_REGISTER] = "register",
18 [KEY_SET] = "set",
19 NULL,
20};
21
22const char* mya_operators[] = {
23 [OP_AND] = "&",
24 // clang-format hates me.
25 [OP_DIV] = "/",
26 [OP_MINUS] = "-",
27 [OP_MULT] = "*",
28 [OP_NOT] = "~",
29 [OP_OR] = "|",
30 [OP_PLUS] = "+",
31 [OP_SHIFT_LEFT] = "<<",
32 [OP_SHIFT_RIGHT] = ">>",
33 [OP_XOR] = "^",
34 NULL,
35};
36
37const char* mya_types[] = {
38 [TYPE_IMMEDIATE] = "immediate",
39 // clang-format hates me.
40 [TYPE_REGISTER] = "register",
41 NULL,
42};
43
44const char* mya_token_types[] = {
45 [TK_CLOSE_BRACES] = "close_braces",
46 // clang-format hates me.
47 [TK_CLOSE_BRACKET] = "close_bracket",
48 [TK_CLOSE_PARENS] = "close_parentheses",
49 [TK_COLON] = "colon",
50 [TK_COMMA] = "comma",
51 [TK_EOF] = "end_of_file",
52 [TK_EQUAL] = "equal",
53 [TK_IDENTIFIER] = "identifier",
54 [TK_KEYWORD] = "keyword",
55 [TK_NUMBER] = "number",
56 [TK_OPEN_BRACES] = "open_braces",
57 [TK_OPEN_BRACKET] = "open_bracket",
58 [TK_OPEN_PARENS] = "open_parentheses",
59 [TK_OPERATOR] = "operator",
60 [TK_SEMICOLON] = "semicolon",
61 [TK_STRING] = "string",
62 NULL,
63};
64
65const char* mya_node_types[] = {
66 [NT_ARG_LIST] = "argument_list",
67 // clang-format hates me.
68 [NT_ARG] = "argument",
69 [NT_BITFIELD_BODY] = "bitfield_body",
70 [NT_BITFIELD_SPEC] = "bitfield_spec",
71 [NT_EXPRESSION] = "expression",
72 [NT_FIELD_SPEC] = "field_spec",
73 [NT_FIELD] = "field",
74 [NT_IDENTIFIER] = "identifier",
75 [NT_INST_BODY] = "inst_body",
76 [NT_ROOT] = "root",
77 [NT_SIZE_SPEC] = "size_spec",
78 [NT_STATEMENT] = "statement",
79 [NT_STRING] = "string",
80 [NT_TYPE] = "type_name",
81 NULL,
82};
const char * mya_version
Definition globals.c:9
const char * mya_node_types[]
Definition globals.c:65
const char * mya_operators[]
Definition globals.c:22
const char * mya_token_types[]
Definition globals.c:44
const char * mya_keywords[]
Definition globals.c:11
const char * mya_types[]
Definition globals.c:37
@ 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:22
@ NT_ARG
Definition ast.h:11
@ NT_TYPE
Definition ast.h:23
@ NT_FIELD_SPEC
Definition ast.h:15
@ NT_SIZE_SPEC
Definition ast.h:20
@ NT_INST_BODY
Definition ast.h:18
@ NT_IDENTIFIER
Definition ast.h:17
@ NT_STATEMENT
Definition ast.h:21
@ NT_BITFIELD_SPEC
Definition ast.h:13
@ NT_FIELD
Definition ast.h:16
@ NT_EXPRESSION
Definition ast.h:14
@ NT_ROOT
Definition ast.h:19
@ NT_ARG_LIST
Definition ast.h:10
@ NT_BITFIELD_BODY
Definition ast.h:12
@ TYPE_IMMEDIATE
Definition mir.h:19
@ TYPE_REGISTER
Definition mir.h:20
@ TK_OPEN_BRACKET
Definition token.h:23
@ TK_NUMBER
Definition token.h:21
@ TK_STRING
Definition token.h:27
@ TK_IDENTIFIER
Definition token.h:19
@ TK_COLON
Definition token.h:15
@ TK_OPEN_BRACES
Definition token.h:22
@ TK_OPEN_PARENS
Definition token.h:24
@ TK_COMMA
Definition token.h:16
@ TK_CLOSE_PARENS
Definition token.h:14
@ TK_KEYWORD
Definition token.h:20
@ TK_OPERATOR
Definition token.h:25
@ TK_CLOSE_BRACKET
Definition token.h:13
@ TK_EOF
Definition token.h:17
@ TK_CLOSE_BRACES
Definition token.h:12
@ TK_EQUAL
Definition token.h:18
@ TK_SEMICOLON
Definition token.h:26
#define LIBMYA_VERSION
Library version.
Definition version.h:4