// 
// c2.c ... 隧穂セ。蝎ィ縺ァ縺ョ迺ー蠅��蛻ゥ逕ィ萓�
// 

#include<stdio.h>
#include "tokenizer.h"
#include "parser.h"
#include "evaluator.h"
#include "environment.h"

int main(void) {

  // 繧ス繝シ繧ケ繧ウ繝シ繝峨�譁�ュ怜�
  char *source[] = {
    "(def year 2020)",
    "(def days (if (= (% year 4) 0) 366 365))",
    "(def hours (* days 24))",
    "hours",
    "(def x -100)",
    "(def y (- x 100))",
    "(if (< x y) x y)",
    // 蠢�ヲ√↓蠢懊§縺ヲ萓九r霑ス蜉�
    NULL
  };

  // 隧穂セ。蝎ィ縺ァ縺ョ迺ー蠅��蛻ゥ逕ィ (蠢�ヲ√↓蠢懊§縺ヲ蛻晄悄蛹悶d蜻シ縺ウ蜃コ縺励r螟画峩)
  char **p;
  for (p = source; *p != NULL; p++) {
    printf("source: \"%s\"\n", *p);
    tokenize(*p);
    init_parser();
    Tree *tree = parse_expression();
    int val = 0;
    printf("value: %d\n", val);
    putchar('\n');
  }

  return 0;
}