Add a small Hello World program to be assembled
[zilutils.git] / zilc / element.h
1 /*
2  * element.h
3  *
4  * Copyright (C) 2015 Alexander Andrejevic <theflash AT sdf DOT lonestar DOT org>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as
8  * published by the Free Software Foundation, either version 3 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>
18  *
19  * SPDX-License-Identifier: AGPL-3.0-or-later
20  */
21
22 #ifndef __ELEMENT_H__
23 #define __ELEMENT_H__
24
25 #include "list.h"
26
27 enum element_type
28 {
29     TYPE_ATOM,
30     TYPE_STRING,
31     TYPE_NUMBER,
32     TYPE_TUPLE,
33     TYPE_STATEMENT
34 };
35
36 typedef struct element
37 {
38     list_t link;
39     int type;
40
41     union
42     {
43         struct
44         {
45             const char *name;
46             int global;
47         } atom;
48
49         struct
50         {
51             const char *value;
52         } string;
53
54         struct
55         {
56             double value;
57         } number;
58
59         struct
60         {
61             list_t list;
62         } tuple;
63
64         struct
65         {
66             const char *name;
67             list_t parameters;
68         } statement;
69     };
70 } element_t;
71
72
73 element_t *create_atom(const char *name, int global);
74 element_t *create_string(const char *value);
75 element_t *create_number(double value);
76 element_t *create_tuple(list_t *list);
77 element_t *create_statement(const char *name, list_t *parameters);
78
79 #endif