@@ -0,0 +1,36 @@
|
||||
#ifndef FURAS_GEN_HPP
|
||||
#define FURAS_GEN_HPP
|
||||
|
||||
#include "furas/lexer.hpp"
|
||||
#include "furvm/module.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace furas {
|
||||
|
||||
struct generator_error {
|
||||
enum type {
|
||||
Success = 0,
|
||||
Eof = 1,
|
||||
|
||||
UnexpectedEof = -1,
|
||||
UnexpectedToken = -2,
|
||||
UnknownCharacter = -3,
|
||||
UnknownType = -4,
|
||||
} type = Success;
|
||||
std::string message;
|
||||
};
|
||||
|
||||
class generator {
|
||||
public:
|
||||
struct result {
|
||||
generator_error error;
|
||||
furvm::mod mod;
|
||||
};
|
||||
public:
|
||||
static result generate(lexer lexer);
|
||||
};
|
||||
|
||||
} // namespace furas
|
||||
|
||||
#endif // FURAS_GEN_HPP
|
||||
@@ -18,9 +18,14 @@ struct token {
|
||||
Sha256, /**< Label marker(`#`). */
|
||||
Percent, /**< Variable marker(`%`). The more the better. */
|
||||
|
||||
Dot, /**< . */
|
||||
EqSign, /**< `=` */
|
||||
Dot, /**< . */
|
||||
Colon, /**< `:` */
|
||||
|
||||
// Keywords
|
||||
Func, /**< `func` keyword for defining functions. */
|
||||
Type, /**< `type` keyword for defining types. */
|
||||
Native, /**< `native` keyword for native functions. :v: */
|
||||
Import, /**< `import` keyword for importing functions and types. */
|
||||
Public, /**< `public` access specifier. */
|
||||
Private, /**< `private` access specifier. */
|
||||
@@ -29,6 +34,7 @@ struct token {
|
||||
Push,
|
||||
Array,
|
||||
Get,
|
||||
Set,
|
||||
Drop,
|
||||
Dup,
|
||||
Clone,
|
||||
@@ -50,7 +56,7 @@ struct token {
|
||||
Load,
|
||||
Store,
|
||||
Call,
|
||||
Jump,
|
||||
Jmp,
|
||||
Jnz,
|
||||
Ret,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user