mie: add dialect data structures, and some builtin dialects
This commit is contained in:
18
mie/dialect/ptr/load.c
Normal file
18
mie/dialect/ptr/load.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_ptr_load, "load")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
32
mie/dialect/ptr/ptr.c
Normal file
32
mie/dialect/ptr/ptr.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/type.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
struct ptr_type {
|
||||
struct mie_dialect_type ptr_base;
|
||||
};
|
||||
|
||||
static enum mie_status print(
|
||||
const struct mie_dialect_type *def, const struct mie_type *ty, b_stream *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum mie_status parse(
|
||||
const struct mie_dialect_type *def, struct mie_parser *parser,
|
||||
struct mie_type **out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_TYPE_BEGIN(mie_ptr_ptr, "ptr")
|
||||
MIE_DIALECT_TYPE_STRUCT(struct ptr_type);
|
||||
MIE_DIALECT_TYPE_PRINT(print);
|
||||
MIE_DIALECT_TYPE_PARSE(parse);
|
||||
MIE_DIALECT_TYPE_END()
|
||||
|
||||
MIE_DIALECT_BEGIN(mie_ptr, "ptr")
|
||||
MIE_DIALECT_ADD_OP(mie_ptr_load);
|
||||
MIE_DIALECT_ADD_OP(mie_ptr_store);
|
||||
MIE_DIALECT_ADD_TYPE(mie_ptr_ptr);
|
||||
MIE_DIALECT_END()
|
||||
18
mie/dialect/ptr/store.c
Normal file
18
mie/dialect/ptr/store.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_ptr_store, "store")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
Reference in New Issue
Block a user