frontend: remove references to old mie api
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
#include "../debug.h"
|
#include "../debug.h"
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <fx/cmd.h>
|
#include <fx/cmd.h>
|
||||||
#include <fx/ds/string.h>
|
#include <fx/ds/string.h>
|
||||||
#include <fx/term.h>
|
#include <fx/term.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <ivy/asm/assembler.h>
|
#include <ivy/asm/assembler.h>
|
||||||
#include <ivy/asm/lex.h>
|
#include <ivy/asm/lex.h>
|
||||||
#include <ivy/asm/parse.h>
|
#include <ivy/asm/parse.h>
|
||||||
@@ -87,7 +87,7 @@ static int assemble_file(const char *in_path, const char *out_path)
|
|||||||
if (status != IVY_OK) {
|
if (status != IVY_OK) {
|
||||||
fx_err("failed to parse '%s'", in_path);
|
fx_err("failed to parse '%s'", in_path);
|
||||||
fx_i("reason: lex error (%s)",
|
fx_i("reason: lex error (%s)",
|
||||||
ivy_status_to_string(ivy_asm_lexer_get_status(lex)));
|
ivy_status_to_string(ivy_asm_lexer_get_status(lex)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ static int assemble_file(const char *in_path, const char *out_path)
|
|||||||
if (status != IVY_OK) {
|
if (status != IVY_OK) {
|
||||||
fx_err("failed to parse '%s'", in_path);
|
fx_err("failed to parse '%s'", in_path);
|
||||||
fx_i("reason: parse error (%s)",
|
fx_i("reason: parse error (%s)",
|
||||||
ivy_status_to_string(status));
|
ivy_status_to_string(status));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,8 @@ static fx_string *generate_object_filename(const char *src_filename)
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int assemble(const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
static int assemble(
|
||||||
|
const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
||||||
{
|
{
|
||||||
const char *in_path = NULL;
|
const char *in_path = NULL;
|
||||||
const char *out_path = NULL;
|
const char *out_path = NULL;
|
||||||
@@ -229,7 +230,7 @@ static int assemble(const fx_command *cmd, const fx_arglist *args, const fx_arra
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
B_COMMAND(CMD_ASSEMBLE, CMD_ROOT)
|
FX_COMMAND(CMD_ASSEMBLE, CMD_ROOT)
|
||||||
{
|
{
|
||||||
FX_COMMAND_NAME("assemble");
|
FX_COMMAND_NAME("assemble");
|
||||||
FX_COMMAND_SHORT_NAME('A');
|
FX_COMMAND_SHORT_NAME('A');
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#include "../debug.h"
|
#include "../debug.h"
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
#include "mie/select/builder.h"
|
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <fx/cmd.h>
|
#include <fx/cmd.h>
|
||||||
#include <fx/core/error.h>
|
#include <fx/core/error.h>
|
||||||
#include <fx/term.h>
|
#include <fx/term.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <ivy/asm/mie.h>
|
#include <ivy/asm/mie.h>
|
||||||
#include <ivy/diag.h>
|
#include <ivy/diag.h>
|
||||||
#include <ivy/file.h>
|
#include <ivy/file.h>
|
||||||
@@ -15,11 +14,6 @@
|
|||||||
#include <ivy/lang/lex.h>
|
#include <ivy/lang/lex.h>
|
||||||
#include <mie/ctx.h>
|
#include <mie/ctx.h>
|
||||||
#include <mie/ir/block.h>
|
#include <mie/ir/block.h>
|
||||||
#include <mie/ir/convert.h>
|
|
||||||
#include <mie/ir/func.h>
|
|
||||||
#include <mie/ir/module.h>
|
|
||||||
#include <mie/select/builder.h>
|
|
||||||
#include <mie/select/graph.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -51,7 +45,6 @@ struct compile_ctx {
|
|||||||
struct ivy_codegen *codegen;
|
struct ivy_codegen *codegen;
|
||||||
|
|
||||||
struct mie_ctx *mie_ctx;
|
struct mie_ctx *mie_ctx;
|
||||||
struct mie_select_builder *select;
|
|
||||||
|
|
||||||
struct mie_module *mod;
|
struct mie_module *mod;
|
||||||
};
|
};
|
||||||
@@ -92,8 +85,10 @@ static fx_result compile_ctx_init(struct compile_ctx *ctx, const fx_arglist *arg
|
|||||||
ivy_status = ivy_lexer_create(&ctx->lex);
|
ivy_status = ivy_lexer_create(&ctx->lex);
|
||||||
ivy_status = ivy_parser_create(&ctx->parser);
|
ivy_status = ivy_parser_create(&ctx->parser);
|
||||||
ivy_status = ivy_codegen_create(ctx->mie_ctx, &ctx->codegen);
|
ivy_status = ivy_codegen_create(ctx->mie_ctx, &ctx->codegen);
|
||||||
|
#if 0
|
||||||
ctx->select
|
ctx->select
|
||||||
= mie_select_builder_create(ctx->mie_ctx, ivy_asm_mie_target());
|
= mie_select_builder_create(ctx->mie_ctx, ivy_asm_mie_target());
|
||||||
|
#endif
|
||||||
|
|
||||||
ivy_lang_diag_ctx_init(ctx->diag);
|
ivy_lang_diag_ctx_init(ctx->diag);
|
||||||
ivy_diag_stream_init_tty(&ctx->diag_stream, fx_stdtty);
|
ivy_diag_stream_init_tty(&ctx->diag_stream, fx_stdtty);
|
||||||
@@ -105,9 +100,11 @@ static fx_result compile_ctx_init(struct compile_ctx *ctx, const fx_arglist *arg
|
|||||||
|
|
||||||
static fx_result compile_ctx_cleanup(struct compile_ctx *ctx)
|
static fx_result compile_ctx_cleanup(struct compile_ctx *ctx)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if (ctx->mod) {
|
if (ctx->mod) {
|
||||||
mie_value_destroy(MIE_VALUE(ctx->mod));
|
mie_value_destroy(MIE_VALUE(ctx->mod));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ctx->src) {
|
if (ctx->src) {
|
||||||
ivy_diag_ctx_set_line_source(ctx->diag, NULL);
|
ivy_diag_ctx_set_line_source(ctx->diag, NULL);
|
||||||
@@ -115,9 +112,11 @@ static fx_result compile_ctx_cleanup(struct compile_ctx *ctx)
|
|||||||
ivy_file_close(ctx->src);
|
ivy_file_close(ctx->src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (ctx->select) {
|
if (ctx->select) {
|
||||||
mie_select_builder_destroy(ctx->select);
|
mie_select_builder_destroy(ctx->select);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ctx->codegen) {
|
if (ctx->codegen) {
|
||||||
ivy_codegen_destroy(ctx->codegen);
|
ivy_codegen_destroy(ctx->codegen);
|
||||||
@@ -135,9 +134,11 @@ static fx_result compile_ctx_cleanup(struct compile_ctx *ctx)
|
|||||||
ivy_diag_ctx_destroy(ctx->diag);
|
ivy_diag_ctx_destroy(ctx->diag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (ctx->mie_ctx) {
|
if (ctx->mie_ctx) {
|
||||||
mie_ctx_destroy(ctx->mie_ctx);
|
mie_ctx_destroy(ctx->mie_ctx);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return FX_RESULT_SUCCESS;
|
return FX_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -226,6 +227,7 @@ static fx_result generate_mie_ir(struct compile_ctx *ctx)
|
|||||||
return FX_RESULT_SUCCESS;
|
return FX_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static fx_result build_block_isel_graph(
|
static fx_result build_block_isel_graph(
|
||||||
struct compile_ctx *ctx, struct mie_func *func, struct mie_block *block)
|
struct compile_ctx *ctx, struct mie_func *func, struct mie_block *block)
|
||||||
{
|
{
|
||||||
@@ -307,6 +309,7 @@ static fx_result build_isel_graph(struct compile_ctx *ctx)
|
|||||||
|
|
||||||
return FX_RESULT_SUCCESS;
|
return FX_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static fx_result dump_ast(struct compile_ctx *ctx)
|
static fx_result dump_ast(struct compile_ctx *ctx)
|
||||||
{
|
{
|
||||||
@@ -323,6 +326,7 @@ static fx_result dump_ast(struct compile_ctx *ctx)
|
|||||||
|
|
||||||
static fx_result dump_ir(struct compile_ctx *ctx)
|
static fx_result dump_ir(struct compile_ctx *ctx)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
struct mie_ir_converter *convert
|
struct mie_ir_converter *convert
|
||||||
= mie_ir_converter_create(ctx->mie_ctx, MIE_IR_MEM, MIE_IR_TEXT);
|
= mie_ir_converter_create(ctx->mie_ctx, MIE_IR_MEM, MIE_IR_TEXT);
|
||||||
mie_ir_converter_set_src_value(convert, MIE_VALUE(ctx->mod));
|
mie_ir_converter_set_src_value(convert, MIE_VALUE(ctx->mod));
|
||||||
@@ -330,21 +334,22 @@ static fx_result dump_ir(struct compile_ctx *ctx)
|
|||||||
mie_ir_converter_process(convert);
|
mie_ir_converter_process(convert);
|
||||||
|
|
||||||
mie_ir_converter_destroy(convert);
|
mie_ir_converter_destroy(convert);
|
||||||
|
#endif
|
||||||
|
|
||||||
return FX_RESULT_SUCCESS;
|
return FX_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compile_file(const char *path, const fx_arglist *args)
|
static int compile_file(const char *path, const fx_arglist *args)
|
||||||
{
|
{
|
||||||
#define THROW_AND_RETURN(result, error_code) \
|
#define THROW_AND_RETURN(result, error_code) \
|
||||||
do { \
|
do { \
|
||||||
if (fx_result_is(result, IVY_ERROR_VENDOR, IVY_ERR_BAD_SYNTAX)) { \
|
if (fx_result_is(result, IVY_ERROR_VENDOR, IVY_ERR_BAD_SYNTAX)) { \
|
||||||
return error_code; \
|
return error_code; \
|
||||||
} \
|
} \
|
||||||
if (fx_result_is_error(result)) { \
|
if (fx_result_is_error(result)) { \
|
||||||
fx_throw(result); \
|
fx_throw(result); \
|
||||||
return error_code; \
|
return error_code; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
struct compile_ctx ctx;
|
struct compile_ctx ctx;
|
||||||
@@ -383,12 +388,14 @@ static int compile_file(const char *path, const fx_arglist *args)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
result = build_isel_graph(&ctx);
|
result = build_isel_graph(&ctx);
|
||||||
THROW_AND_RETURN(result, -1);
|
THROW_AND_RETURN(result, -1);
|
||||||
|
|
||||||
if (progress == 3) {
|
if (progress == 3) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
end:
|
end:
|
||||||
compile_ctx_cleanup(&ctx);
|
compile_ctx_cleanup(&ctx);
|
||||||
@@ -416,7 +423,7 @@ static int compile(const fx_command *cmd, const fx_arglist *args, const fx_array
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
B_COMMAND(CMD_COMPILE, CMD_ROOT)
|
FX_COMMAND(CMD_COMPILE, CMD_ROOT)
|
||||||
{
|
{
|
||||||
FX_COMMAND_NAME("compile");
|
FX_COMMAND_NAME("compile");
|
||||||
FX_COMMAND_SHORT_NAME('C');
|
FX_COMMAND_SHORT_NAME('C');
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <fx/cmd.h>
|
#include <fx/cmd.h>
|
||||||
#include <fx/ds/string.h>
|
#include <fx/ds/string.h>
|
||||||
#include <fx/term.h>
|
#include <fx/term.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <ivy/asm/assembler.h>
|
#include <ivy/asm/assembler.h>
|
||||||
#include <ivy/asm/instr.h>
|
#include <ivy/asm/instr.h>
|
||||||
@@ -305,7 +305,8 @@ static enum ivy_status dump_class(
|
|||||||
printf("type:variable\n");
|
printf("type:variable\n");
|
||||||
struct ivy_asm_constpool_value *var_ident = NULL;
|
struct ivy_asm_constpool_value *var_ident = NULL;
|
||||||
status = ivy_asm_constpool_reader_read_value(
|
status = ivy_asm_constpool_reader_read_value(
|
||||||
pool, fx_i32_btoh(entry.e_mvar.m_ident), &var_ident);
|
pool, fx_i32_btoh(entry.e_mvar.m_ident),
|
||||||
|
&var_ident);
|
||||||
if (status != IVY_OK) {
|
if (status != IVY_OK) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -654,17 +655,20 @@ static int disassemble(
|
|||||||
bool header = fx_arglist_get_count(args, OPT_HEADER, FX_COMMAND_INVALID_ID)
|
bool header = fx_arglist_get_count(args, OPT_HEADER, FX_COMMAND_INVALID_ID)
|
||||||
> 0;
|
> 0;
|
||||||
bool sections
|
bool sections
|
||||||
= fx_arglist_get_count(args, OPT_SECTIONS, FX_COMMAND_INVALID_ID) > 0;
|
= fx_arglist_get_count(args, OPT_SECTIONS, FX_COMMAND_INVALID_ID)
|
||||||
|
> 0;
|
||||||
bool dump = fx_arglist_get_count(args, OPT_DUMP, FX_COMMAND_INVALID_ID) > 0;
|
bool dump = fx_arglist_get_count(args, OPT_DUMP, FX_COMMAND_INVALID_ID) > 0;
|
||||||
bool constpool
|
bool constpool
|
||||||
= fx_arglist_get_count(args, OPT_CONSTPOOL, FX_COMMAND_INVALID_ID)
|
= fx_arglist_get_count(args, OPT_CONSTPOOL, FX_COMMAND_INVALID_ID)
|
||||||
> 0;
|
> 0;
|
||||||
bool classes
|
bool classes
|
||||||
= fx_arglist_get_count(args, OPT_CLASSES, FX_COMMAND_INVALID_ID) > 0;
|
= fx_arglist_get_count(args, OPT_CLASSES, FX_COMMAND_INVALID_ID)
|
||||||
|
> 0;
|
||||||
|
|
||||||
const char *in_path = NULL;
|
const char *in_path = NULL;
|
||||||
|
|
||||||
fx_arglist_get_string(args, FX_COMMAND_INVALID_ID, ARG_BIN_FILE, 0, &in_path);
|
fx_arglist_get_string(
|
||||||
|
args, FX_COMMAND_INVALID_ID, ARG_BIN_FILE, 0, &in_path);
|
||||||
if (!in_path) {
|
if (!in_path) {
|
||||||
fx_err("no input file specified.");
|
fx_err("no input file specified.");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -717,7 +721,7 @@ static int disassemble(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
B_COMMAND(CMD_DISASSEMBLE, CMD_ROOT)
|
FX_COMMAND(CMD_DISASSEMBLE, CMD_ROOT)
|
||||||
{
|
{
|
||||||
FX_COMMAND_NAME("disassemble");
|
FX_COMMAND_NAME("disassemble");
|
||||||
FX_COMMAND_SHORT_NAME('D');
|
FX_COMMAND_SHORT_NAME('D');
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ static int exec(const fx_command *cmd, const fx_arglist *args, const fx_array *_
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
B_COMMAND(CMD_ROOT, FX_COMMAND_INVALID_ID)
|
FX_COMMAND(CMD_ROOT, FX_COMMAND_INVALID_ID)
|
||||||
{
|
{
|
||||||
FX_COMMAND_NAME("ivy");
|
FX_COMMAND_NAME("ivy");
|
||||||
FX_COMMAND_DESC("evaluate an Ivy source file or Ivy object file.");
|
FX_COMMAND_DESC("evaluate an Ivy source file or Ivy object file.");
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
#include <fx/cmd.h>
|
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
#include <ivy/lang/lex.h>
|
|
||||||
#include <ivy/lang/internal.h>
|
#include <fx/cmd.h>
|
||||||
#include <fx/term.h>
|
#include <fx/term.h>
|
||||||
|
#include <ivy/lang/internal.h>
|
||||||
|
#include <ivy/lang/lex.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
OPT_PRINT_SYMBOLS = 0x1000,
|
OPT_PRINT_SYMBOLS = 0x1000,
|
||||||
OPT_PRINT_KEYWORDS,
|
OPT_PRINT_KEYWORDS,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int internal(const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
static int internal(
|
||||||
|
const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
||||||
{
|
{
|
||||||
struct ivy_lexer *lex;
|
struct ivy_lexer *lex;
|
||||||
enum ivy_status status = ivy_lexer_create(&lex);
|
enum ivy_status status = ivy_lexer_create(&lex);
|
||||||
|
|
||||||
if (status != IVY_OK) {
|
if (status != IVY_OK) {
|
||||||
fx_err("failed to initialise lexer (error %s)",
|
fx_err("failed to initialise lexer (error %s)",
|
||||||
ivy_status_to_string(status));
|
ivy_status_to_string(status));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +35,7 @@ static int internal(const fx_command *cmd, const fx_arglist *args, const fx_arra
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
B_COMMAND(CMD_INTERNAL, CMD_ROOT)
|
FX_COMMAND(CMD_INTERNAL, CMD_ROOT)
|
||||||
{
|
{
|
||||||
FX_COMMAND_NAME("internal");
|
FX_COMMAND_NAME("internal");
|
||||||
FX_COMMAND_SHORT_NAME('X');
|
FX_COMMAND_SHORT_NAME('X');
|
||||||
@@ -53,7 +55,8 @@ B_COMMAND(CMD_INTERNAL, CMD_ROOT)
|
|||||||
FX_OPTION_LONG_NAME("print-keywords");
|
FX_OPTION_LONG_NAME("print-keywords");
|
||||||
FX_OPTION_SHORT_NAME('k');
|
FX_OPTION_SHORT_NAME('k');
|
||||||
FX_OPTION_DESC(
|
FX_OPTION_DESC(
|
||||||
"print the keyword dictionary used by the language lexer.");
|
"print the keyword dictionary used by the language "
|
||||||
|
"lexer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_COMMAND_HELP_OPTION();
|
FX_COMMAND_HELP_OPTION();
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
#include <ivy/lang/codegen.h>
|
#include <ivy/lang/codegen.h>
|
||||||
#include <ivy/lang/lex.h>
|
#include <ivy/lang/lex.h>
|
||||||
#include <mie/ctx.h>
|
#include <mie/ctx.h>
|
||||||
#include <mie/ir/convert.h>
|
|
||||||
#include <mie/ir/value.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -27,7 +25,10 @@ struct repl {
|
|||||||
struct ivy_lexer *r_lex;
|
struct ivy_lexer *r_lex;
|
||||||
struct ivy_parser *r_parse;
|
struct ivy_parser *r_parse;
|
||||||
struct ivy_codegen *r_codegen;
|
struct ivy_codegen *r_codegen;
|
||||||
|
|
||||||
|
#if 0
|
||||||
struct mie_ir_converter *r_converter;
|
struct mie_ir_converter *r_converter;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void skip_line(struct ivy_lexer *lex)
|
static void skip_line(struct ivy_lexer *lex)
|
||||||
@@ -89,17 +90,21 @@ static int repl_eval_node(struct repl *repl, struct ivy_ast_node *node)
|
|||||||
ivy_codegen_push_eof(repl->r_codegen);
|
ivy_codegen_push_eof(repl->r_codegen);
|
||||||
|
|
||||||
struct mie_module *mod = ivy_codegen_get_current_module(repl->r_codegen);
|
struct mie_module *mod = ivy_codegen_get_current_module(repl->r_codegen);
|
||||||
|
#if 0
|
||||||
mie_ir_converter_set_src_value(repl->r_converter, MIE_VALUE(mod));
|
mie_ir_converter_set_src_value(repl->r_converter, MIE_VALUE(mod));
|
||||||
mie_ir_converter_process(repl->r_converter);
|
mie_ir_converter_process(repl->r_converter);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void repl_destroy(struct repl *repl)
|
static void repl_destroy(struct repl *repl)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if (repl->r_converter) {
|
if (repl->r_converter) {
|
||||||
mie_ir_converter_destroy(repl->r_converter);
|
mie_ir_converter_destroy(repl->r_converter);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (repl->r_codegen) {
|
if (repl->r_codegen) {
|
||||||
ivy_codegen_destroy(repl->r_codegen);
|
ivy_codegen_destroy(repl->r_codegen);
|
||||||
@@ -117,9 +122,11 @@ static void repl_destroy(struct repl *repl)
|
|||||||
line_ed_destroy(repl->r_ed);
|
line_ed_destroy(repl->r_ed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (repl->r_mie) {
|
if (repl->r_mie) {
|
||||||
mie_ctx_destroy(repl->r_mie);
|
mie_ctx_destroy(repl->r_mie);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
free(repl);
|
free(repl);
|
||||||
}
|
}
|
||||||
@@ -167,6 +174,7 @@ static enum ivy_status repl_create(struct repl **out)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
repl->r_converter
|
repl->r_converter
|
||||||
= mie_ir_converter_create(repl->r_mie, MIE_IR_MEM, MIE_IR_TEXT);
|
= mie_ir_converter_create(repl->r_mie, MIE_IR_MEM, MIE_IR_TEXT);
|
||||||
if (!repl->r_converter) {
|
if (!repl->r_converter) {
|
||||||
@@ -175,6 +183,7 @@ static enum ivy_status repl_create(struct repl **out)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mie_ir_converter_set_dest_file(repl->r_converter, stdout);
|
mie_ir_converter_set_dest_file(repl->r_converter, stdout);
|
||||||
|
#endif
|
||||||
|
|
||||||
*out = repl;
|
*out = repl;
|
||||||
return IVY_OK;
|
return IVY_OK;
|
||||||
@@ -217,7 +226,8 @@ int repl(const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
|||||||
args, OPT_SHOW_AST_NODES, FX_COMMAND_INVALID_ID)
|
args, OPT_SHOW_AST_NODES, FX_COMMAND_INVALID_ID)
|
||||||
> 0;
|
> 0;
|
||||||
repl->r_show_ir
|
repl->r_show_ir
|
||||||
= fx_arglist_get_count(args, OPT_SHOW_IR, FX_COMMAND_INVALID_ID) > 0;
|
= fx_arglist_get_count(args, OPT_SHOW_IR, FX_COMMAND_INVALID_ID)
|
||||||
|
> 0;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
struct ivy_token *tok = ivy_lexer_read(repl->r_lex);
|
struct ivy_token *tok = ivy_lexer_read(repl->r_lex);
|
||||||
@@ -228,8 +238,8 @@ int repl(const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
|||||||
|
|
||||||
if (status != IVY_OK) {
|
if (status != IVY_OK) {
|
||||||
fx_err("lex error (%s)",
|
fx_err("lex error (%s)",
|
||||||
ivy_status_to_string(
|
ivy_status_to_string(
|
||||||
ivy_lexer_get_status(repl->r_lex)));
|
ivy_lexer_get_status(repl->r_lex)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +267,7 @@ int repl(const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
|||||||
repl_eval_node(repl, unit);
|
repl_eval_node(repl, unit);
|
||||||
ivy_codegen_end_module(repl->r_codegen, &mod);
|
ivy_codegen_end_module(repl->r_codegen, &mod);
|
||||||
|
|
||||||
mie_value_destroy(MIE_VALUE(mod));
|
// mie_value_destroy(MIE_VALUE(mod));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
while ((child = ivy_parser_dequeue_node(repl->r_parse))) {
|
while ((child = ivy_parser_dequeue_node(repl->r_parse))) {
|
||||||
@@ -271,7 +281,7 @@ int repl(const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
B_COMMAND(CMD_REPL, CMD_ROOT)
|
FX_COMMAND(CMD_REPL, CMD_ROOT)
|
||||||
{
|
{
|
||||||
FX_COMMAND_NAME("shell");
|
FX_COMMAND_NAME("shell");
|
||||||
FX_COMMAND_SHORT_NAME('S');
|
FX_COMMAND_SHORT_NAME('S');
|
||||||
|
|||||||
Reference in New Issue
Block a user