brewery
notashelf /
49f64c9c98c1477289fce86b175eb203ab5d3f15

nixir

public

Import-resolving Nix IR plugin

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/nixir.git
src/irc/ir_gen.hC45 lines854 B
1
#ifndef NIX_IRC_IR_GEN_H
2
#define NIX_IRC_IR_GEN_H
3
4
#include "types.h"
5
#include <string>
6
#include <unordered_map>
7
#include <vector>
8
#include <memory>
9
10
namespace nix_irc {
11
12
class IRGenerator {
13
public:
14
    IRGenerator();
15
    ~IRGenerator();
16
    
17
    void set_string_table(const std::unordered_map<std::string, uint32_t>& table);
18
    uint32_t add_string(const std::string& str);
19
    
20
    std::shared_ptr<Node> generate(const std::shared_ptr<Node>& ast);
21
    
22
private:
23
    struct Impl;
24
    std::unique_ptr<Impl> pImpl;
25
};
26
27
class NameResolver {
28
public:
29
    NameResolver();
30
    ~NameResolver();
31
    
32
    void enter_scope();
33
    void exit_scope();
34
    void bind(const std::string& name);
35
    uint32_t resolve(const std::string& name);
36
    bool is_bound(const std::string& name) const;
37
    
38
private:
39
    struct Impl;
40
    std::unique_ptr<Impl> pImpl;
41
};
42
43
}
44
45
#endif