4 #ifndef CHI_LANG_MODULE_HPP 5 #define CHI_LANG_MODULE_HPP 12 #include <unordered_map> 25 std::unique_ptr<NodeType>* toFill)
override;
30 std::vector<std::string> ret;
31 ret.reserve(nodes.size());
33 std::transform(nodes.begin(), nodes.end(), std::back_inserter(ret),
34 [](
auto pair) {
return pair.first; });
39 std::vector<std::string>
typeNames()
const override {
40 return {
"i32",
"i1",
"float",
"i8*"};
48 std::unordered_map<std::string,
49 std::function<std::unique_ptr<NodeType>(
const nlohmann::json&,
Result&)>>
51 std::unordered_map<std::string, llvm::DIType*> mDebugTypes;
55 #endif // CHI_LANG_MODULE_HPP Result nodeTypeFromName(boost::string_view name, const nlohmann::json &jsonData, std::unique_ptr< NodeType > *toFill) override
Create a node type that is in the module from the name and json.
Forward declares all the chigraph data types.
The module that provides built-in operations like literals, math operations, etc. ...
std::vector< std::string > nodeTypeNames() const override
Get the possible node type names.
std::vector< std::string > typeNames() const override
Get the possible DataType names.
The class that handles the loading, creation, storing, and compilation of modules It also stores a LL...
An abstract class that represents a module of code in Chigraph Can be compiled to a llvm::Module...
Result addForwardDeclarations(llvm::Module &module) const override
Adds forward declartions for the functions in this module.
DataType typeFromName(boost::string_view name) override
Get a DataType from the name.
Result generateModule(llvm::Module &) override
Generate a llvm::Module from the module.
Defines the ChiModule class.
The namespace where chigraph lives.
LangModule(Context &ctx)
Default constructor, usually called from Context::loadModule("lang")
A type of data Loose wrapper around llvm::Type*, except it knows which ChiModule it's in and it embed...
The result object, used for identifiying errors with good diagnostics.