49 lines
843 B
C
49 lines
843 B
C
#include "computorv1.h"
|
|
#include "lexer.h"
|
|
#include "errors.h"
|
|
|
|
int main(int ac, char **av)
|
|
{
|
|
int i;
|
|
int ret;
|
|
|
|
if (ac < 2)
|
|
{
|
|
return 0;
|
|
}
|
|
i = 0;
|
|
while (i < ac)
|
|
{
|
|
ft_putnbr(i);
|
|
ft_putstr(" : ");
|
|
ft_putstr(av[i]);
|
|
ft_putchar('\n');
|
|
i++;
|
|
}
|
|
|
|
token tokens[MAX_TOKENS];
|
|
ret = lexerize(av[1], tokens);
|
|
if (ret <= 0)
|
|
{
|
|
stop_errors(ret);
|
|
}
|
|
|
|
// tmp debug output
|
|
i = 0;
|
|
while (tokens[i].type != TOKEN_END)
|
|
{
|
|
ft_printf("token %i :\n type : %i\n value : ", i, tokens[i].type);
|
|
if (tokens[i].type == TOKEN_NUMBER)
|
|
{
|
|
ft_printf("%d\n", i, tokens[i].num_value);
|
|
}
|
|
else
|
|
{
|
|
ft_printf("%c\n", tokens[i].var_value);
|
|
}
|
|
i++;
|
|
}
|
|
|
|
return (0);
|
|
}
|