git » unicorn-sparkle-basic.git » master » tree

[master] / main.c

/*
 * This file is part of Unicorn Sparkle Basic and is released under
 * CC0 1.0 Universal License.  See LICENSE.txt file or
 * https://creativecommons.org/publicdomain/zero/1.0/ for full license
 * text.
 */

#include "lines.h"
#include <stdio.h>

/* TODO */
/* env hashtable */
/* eval_expr - returns a TYPE */
/* eval_stmt - returns void but optionally sets jump dest */
void eval_stmt(struct node_tag *node) {
  /* switch (node->type) { */
  /*   case  */
  /* } */
}

void run(struct node_tag **lines) {
}

void read_loop() {
  struct node_tag *line;
  struct node_tag **lines = vector_create();
  while (1) {
    if ((line = read_line_stdin("🦄 "))) {
      switch (line->type) {
      case NODE_COMMAND_RUN:
        printf("RUN command entered\n");
        printf("found = %zu\n", lines_find_idx(lines, 99));
        break;
      case NODE_NUMBERED_LINE:
        printf("linum: %g\n", line->data.line.linum);
        lines_insert(&lines, line);
        break;
      default:
        /* die */
      }
      /* lines_print(lines); */
    }
  }
}

int main() {
  printf("✨ Welcome to Unicorn Sparkle Basic! ✨\n");
  read_loop();
  return 0;
}