Rename files

This commit is contained in:
2026-01-22 20:56:02 +08:00
parent 8c5197c760
commit 5aa4efede7
12 changed files with 872 additions and 1604 deletions

View File

@@ -1,28 +1,59 @@
#ifndef CAMELLYA_LIBRARY_H
#define CAMELLYA_LIBRARY_H
#ifndef CAMELLYA_STATE_H
#define CAMELLYA_STATE_H
// Camellya Scripting Language
// A Lua-like scripting language with 0-based indexing,
// distinct list/map types, and class support
#include "state.h"
#include "value.h"
#include "lexer.h"
#include "parser.h"
#include "interpreter.h"
#include "ast.h"
#include "vm.h"
#include "compiler.h"
#include "chunk.h"
#include "opcode.h"
#include "exceptions.h"
#include <memory>
#include <string>
namespace camellya {
// Version info
constexpr const char* VERSION = "0.1.0";
constexpr const char* VERSION_NAME = "Camellya";
// Main state class - similar to lua_State
class CamellyaImpl;
class Camellya {
public:
Camellya();
~Camellya();
// Execute script from string
bool do_string(const std::string &script);
// Execute script from file
bool do_file(const std::string &filename);
// Register native function
void register_function(const std::string &name, NativeFunction func);
// Get global variable
ValuePtr get_global(const std::string &name);
// Set global variable
void set_global(const std::string &name, ValuePtr value);
// Stack operations (Lua-like API)
void push_number(double value);
void push_string(const std::string &value);
void push_bool(bool value);
void push_nil();
void push_value(ValuePtr value);
double to_number(int index);
std::string to_string(int index);
bool to_bool(int index);
ValuePtr to_value(int index);
int get_top() const;
void set_top(int index);
void pop(int n = 1);
// Error handling
const std::string &get_error() const;
private:
std::unique_ptr<CamellyaImpl> d;
ValuePtr get_stack_value(int index);
};
} // namespace camellya
#endif // CAMELLYA_LIBRARY_H
#endif // CAMELLYA_STATE_H