Spicy
spicy
toolchain
include
compiler
detail
codegen
grammar-builder.h
1
// Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2
3
#pragma once
4
5
#include <functional>
6
#include <map>
7
#include <string>
8
9
#include <spicy/ast/types/unit.h>
10
#include <spicy/compiler/detail/codegen/grammar.h>
11
#include <spicy/compiler/detail/codegen/production.h>
12
#include <spicy/compiler/detail/codegen/productions/all.h>
13
14
namespace
spicy::logging::debug
{
15
inline
const
hilti::logging::DebugStream
Grammar(
"grammar"
);
16
}
// namespace spicy::logging::debug
17
18
namespace
spicy::detail
{
19
20
class
CodeGen;
21
22
namespace
codegen {
23
25
class
GrammarBuilder
{
26
public
:
27
GrammarBuilder
(
CodeGen
* cg) : _cg(cg) {}
28
33
Result<Nothing>
run(
const
type::Unit
& unit,
Node
* node,
CodeGen
* cg);
34
40
const
Grammar
& grammar(
const
type::Unit
& unit);
41
42
CodeGen
* cg()
const
{
return
_cg; }
43
44
private
:
45
CodeGen
* _cg;
46
std::map<std::string, Grammar> _grammars;
47
};
48
49
}
// namespace codegen
50
}
// namespace spicy::detail
spicy::type::Unit
Definition:
unit.h:57
spicy::detail
Definition:
engine.h:16
spicy::detail::codegen::GrammarBuilder
Definition:
grammar-builder.h:25
spicy::logging::debug
Definition:
grammar-builder.h:14
spicy::detail::CodeGen
Definition:
codegen.h:30
hilti::Node
Definition:
node.h:112
spicy::detail::codegen::Grammar
Definition:
grammar.h:21
hilti::rt::Result
Definition:
result.h:67
hilti::logging::DebugStream
Definition:
logger.h:28
Generated by
1.8.13