handle superscript powers

This commit is contained in:
hugogogo
2026-05-06 20:01:41 +02:00
parent 4b6ad34720
commit 16c57c9bea
8 changed files with 130 additions and 44 deletions

View File

@@ -10,9 +10,6 @@
#include <errno.h> // for errno
#include <string.h> // for strerror
#include <sys/wait.h>
#include <termios.h> // For tcflush() and TCIFLUSH
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* MAIN.C
*/
@@ -36,16 +33,17 @@ void launch_computorv1(char *input);
typedef enum
{
TOKEN_VARIABLE, // x, y, etc.
TOKEN_NUMBER_INT, // int
TOKEN_NUMBER_DOUBLE, // double
TOKEN_POWER, // ^ or **
TOKEN_SIGN_PLUS, // +
TOKEN_SIGN_MINUS, // -
TOKEN_FACTOR_MULT, // *
TOKEN_FACTOR_DIV, // / or :
TOKEN_EQUAL, // =
TOKEN_END // null (end of input)
TOKEN_VARIABLE, // x, y, etc.
TOKEN_NUMBER_INT, // int
TOKEN_NUMBER_DOUBLE, // double
TOKEN_NUMBER_INT_SUPER, // superscript int, like '²'
TOKEN_POWER, // ^ or **
TOKEN_SIGN_PLUS, // +
TOKEN_SIGN_MINUS, // -
TOKEN_FACTOR_MULT, // *
TOKEN_FACTOR_DIV, // / or :
TOKEN_EQUAL, // =
TOKEN_END // null (end of input)
} e_token_type;
typedef enum
@@ -120,6 +118,12 @@ const char *token_tag_to_str(e_token_tag tag);
const char *term_position_to_str(e_term_position pos);
const char *term_sign_to_str(e_term_sign sign);
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* UTILS/PRINTER.C
*/
void print_debug(const char *description, ...);
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* GLOBALS
*/