⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.h

📁 a basic interpreter free basic
💻 H
字号:
#pragma once
/*
 * Common.h - Container for common data types
 */

// Symbol types
typedef enum { S_NONE, VARIABLE, VECTOR, MATRIX } symboltype_t;

// Token types
// Because of the way that BASIC ignores spaces,
// I have decided to implement mostly single-character
// tokenization and let the parser handle the rest.
// The lexer will, however, tokenize full strings and numbers.
typedef enum { 
	T_NONE,		// Nothing
	ALPHA,		// Character in an identifier
	DIGIT,		// Constant number value
	T_DECIMAL,	// .
	STRING,		// Constant string value
	ADDOP,		// + -
	MULOP,		// * /
	EXPOP,		// ^
	RELOP,		// < <= > >= <> =
	PARENTHESIS,// ( )
	COMMA,		// ,
	EOL			// End of line
} tokentype_t;

// Relational operator enumeration
typedef enum {
	LESSER_THAN,
	LESSER_THAN_OR_EQUAL,
	GREATER_THAN,
	GREATER_THAN_OR_EQUAL,
	NOT_EQUAL,
	EQUAL
} relop_t;

// Token list
class CToken;
typedef list<CToken *> tokenlist_t;
// Symbol list
class CSymbol;
typedef list<CSymbol *> symbollist_t;
// Function list
class CFunction;
typedef list<CFunction *> functionlist_t;
// Code list
class CCodeLine;
typedef list<CCodeLine *> codelinelist_t;

// Structure for a for loop
typedef struct {
	CSymbol *Symbol;
	float Step;
	int LineNumber;
	int EndLineNumber;
} forloop_t;

// Error types
#define DIMENSION_TOO_LARGE		1
#define ILLEGAL_CONSTANT		2
#define ILLEGAL_FORMULA			3
#define ILLEGAL_RELATION		4
#define ILLEGAL_LINE_NUMBER		5
#define ILLEGAL_INSTRUCTION		6
#define ILLEGAL_VARIABLE		7
#define INCORRECT_FORMAT		8
#define END_IS_NOT_LAST			9
#define NO_END_INSTRUCTION		10
#define ERR_NO_DATA				11
#define UNDEFINED_FUNCTION		12
#define UNDEFINED_NUMBER		13
#define PROGRAM_TOO_LONG		14
#define TOO_MUCH_DATA			15
#define TOO_MANY_LABELS			16
#define NOT_MATCH_WITH_FOR		17
#define FOR_WITHOUT_NEXT		18
#define CUT_PROGRAM_OR_DIMS		19
#define SUBSCRIPT_ERROR			20
#define ILLEGAL_RETURN			21

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -