IDL compiler front-end library
Loading...
Searching...
No Matches
CodeGen.h
Go to the documentation of this file.
1
2/*
3* Nirvana IDL front-end library.
4*
5* This is a part of the Nirvana project.
6*
7* Author: Igor Popov
8*
9* Copyright (c) 2021 Igor Popov.
10*
11* This program is free software; you can redistribute it and/or modify
12* it under the terms of the GNU Lesser General Public License as published by
13* the Free Software Foundation; either version 3 of the License, or
14* (at your option) any later version.
15*
16* This program is distributed in the hope that it will be useful,
17* but WITHOUT ANY WARRANTY; without even the implied warranty of
18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19* GNU General Public License for more details.
20*
21* You should have received a copy of the GNU Lesser General Public
22* License along with this library. If not, see <http://www.gnu.org/licenses/>.
23*
24* Send comments and/or bug reports to:
25* popov.nirvana@gmail.com
26*/
27#ifndef IDLFE_AST_CODEGEN_H_
28#define IDLFE_AST_CODEGEN_H_
29#pragma once
30
31#if __cplusplus < 201703L && _MSVC_LANG < 201703L
32#error C++17 compliant compiler is required.
33#endif
34
35#include "Root.h"
36#include "Include.h"
37#include "Native.h"
38#include "TypeDef.h"
39#include "Constant.h"
40#include "Module.h"
41#include "Interface.h"
42#include "Operation.h"
43#include "Parameter.h"
44#include "Attribute.h"
45#include "Struct.h"
46#include "Union.h"
47#include "UnionElement.h"
48#include "Enum.h"
49#include "Exception.h"
50#include "Array.h"
51#include "Sequence.h"
52#include "ValueType.h"
53#include "StateMember.h"
54#include "ValueFactory.h"
55#include "ValueBox.h"
56
57namespace AST {
58
75{
76public:
80 virtual void begin (const Root&) {}
81
85 virtual void end (const Root&) {}
86
88 virtual void leaf (const Include&) = 0;
89
91 virtual void leaf (const Native&) = 0;
92
94 virtual void leaf (const TypeDef&) = 0;
95
97 virtual void leaf (const Constant&) = 0;
98
100 virtual void begin (const ModuleItems&) = 0;
101
103 virtual void end (const ModuleItems&) = 0;
104
106 virtual void leaf (const InterfaceDecl&) = 0;
107
109 virtual void begin (const Interface&) = 0;
110
112 virtual void end (const Interface&) = 0;
113
115 virtual void leaf (const Operation&) = 0;
116
118 virtual void leaf (const Attribute&) = 0;
119
121 virtual void leaf (const Exception&) = 0;
122
124 virtual void leaf (const StructDecl&) = 0;
125
127 virtual void leaf (const Struct&) = 0;
128
130 virtual void leaf (const UnionDecl&) = 0;
131
133 virtual void leaf (const Union&) = 0;
134
136 virtual void leaf (const Enum&) = 0;
137
139 virtual void leaf (const ValueTypeDecl&) = 0;
140
142 virtual void begin (const ValueType&) = 0;
143
145 virtual void end (const ValueType&) = 0;
146
148 virtual void leaf (const StateMember&) = 0;
149
151 virtual void leaf (const ValueFactory&) = 0;
152
154 virtual void leaf (const ValueBox&) = 0;
155};
156
157}
158
162
163#endif
The attribute specification.
Definition Attribute.h:39
Base for code generators. Abstract class.
Definition CodeGen.h:75
virtual void leaf(const Struct &)=0
struct
virtual void begin(const Interface &)=0
interface begin.
virtual void end(const ValueType &)=0
valuetype end.
virtual void leaf(const Include &)=0
#include
virtual void leaf(const Native &)=0
native
virtual void end(const Root &)
Definition CodeGen.h:85
virtual void leaf(const TypeDef &)=0
typedef
virtual void end(const ModuleItems &)=0
module end.
virtual void leaf(const StateMember &)=0
valuetype state member.
virtual void leaf(const StructDecl &)=0
struct forward declaration.
virtual void begin(const ModuleItems &)=0
module begin.
virtual void leaf(const Enum &)=0
enum
virtual void begin(const Root &)
Definition CodeGen.h:80
virtual void leaf(const UnionDecl &)=0
union forward declaration.
virtual void leaf(const Operation &)=0
Operation.
virtual void leaf(const Union &)=0
union
virtual void end(const Interface &)=0
interface end.
virtual void leaf(const Exception &)=0
exception
virtual void leaf(const Attribute &)=0
attribute
virtual void leaf(const Constant &)=0
const
virtual void leaf(const ValueBox &)=0
Boxed valuetype.
virtual void leaf(const InterfaceDecl &)=0
interface forward declaration.
virtual void begin(const ValueType &)=0
valuetype begin.
virtual void leaf(const ValueTypeDecl &)=0
valuetype forward declaration.
virtual void leaf(const ValueFactory &)=0
factory
const definition.
Definition Constant.h:45
The enum declaration.
Definition Enum.h:71
The exception declaration.
Definition Exception.h:41
#include file.
Definition Include.h:44
Interface forward declaration.
Definition Interface.h:138
Interface definition.
Definition Interface.h:95
The seqence of items in a module.
Definition Module.h:73
A 'native` type.
Definition Native.h:41
An operation.
Definition Operation.h:42
Abstract Syntax Tree root.
Definition Root.h:62
State member.
Definition StateMember.h:40
The struct forward declaration.
Definition Struct.h:44
The struct definition.
Definition Struct.h:73
Type alias.
Definition TypeDef.h:43
union forward declaration.
Definition Union.h:45
union definition.
Definition Union.h:75
Boxed value type.
Definition ValueBox.h:43
Value type factory operation.
Value type forward declaration.
Definition ValueType.h:132
Value type definition.
Definition ValueType.h:61
Abstract Syntax Tree namespace.
Definition Array.h:34