Files
Nasal-Interpreter/version2.0/nasal.h
Valk Richard Li 4952ea9002 update
2020-05-26 07:22:27 -07:00

101 lines
3.2 KiB
C++

#ifndef __NASAL_H__
#define __NASAL_H__
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
/* if thread is used, don't forget to add -std=c++11 or higher standard before executing */
// #include <thread>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <map>
/*
nasal_misc.h:
including some functions that change number to string or change string to number
including a function that check if a string is a numerable string
including a function that print the hex format number of an integer
*/
#include "nasal_misc.h"
/*
nasal_enum.h
including enums of: lexer token type,parse generated type,scalar type
lexer token type is used by nasal_lexer
parse generated type is used both by nasal_parse and abstract_syntax_tree
parse generated type is also used when lexer is generating detailed tokens which are used in nasal_parse
scalar type is used in nasal_runtime and nasal_gc
*/
#include "nasal_enum.h"
/*
nasal_ast.h
including a class named abstract_syntax_tree
this class is frequently used in nasal_parse nasal_runtime
*/
#include "nasal_ast.h"
/*
nasal_lexer.h
including a class named resource_file
including a class named nasal_lexer
including a string[] named lib_filename, by this way resource_file can load lib files
including a string[] named reserve_word, it is used in lexer,when generating an identifier,nasal_lexer will check if it is a reserve word
including a struct named token, this struct is often used in nasal_lexer and nasal_parse
including a function named is_reserve_word, checking if an identifier is a reserve word
*/
#include "nasal_lexer.h"
/*
nasal_parse.h
including a class named nasal_parse
nasal_parse uses tokens generated by lexer and generats them into abstract syntax tree
this class has a special enum named parse_error_type
if parse errors occur,this enum will be into use
*/
#include "nasal_parse.h"
/*
nasal_gc.h(garbage collector and memory manager of nasal_runtime)
including basic classed named: nasal_number, nasal_string, nasal_vector, nasal_hash, nasal_function
including important class named gc_manager
including struct named gc_unit, it is the smallest memory unit.used in gc_manager
nasal_gc is an object of class gc_manager,and nasal_runtime uses this object as it's memory manager
*/
#include "nasal_gc.h"
/*
nasal_builtinfunc.h
including built-in functions of nasal lib
all functions in this .cpp will be used in nasal_runtime::builtin_function()
*/
#include "nasal_builtinfunc.h"
/*
nasal_runtime.h
including a class named nasal_runtime
including a string[] named inline_func_name
function that mentioned in inline_func_name is special functions that were written by cpp,so they can be ca;;ed directly
if you want to add new built-in functions:
add it's name into inline_func_name
change the number of nas_lib_func_num
write it's function in nasal_runtime::inline_function
and don't forget to warp it up with a function that written by nasal
for example: print(dyn...)
var print=func(dyn...)
{
nasal_call_inline_c_std_puts(dyn);
return nil;
}
*/
#include "nasal_runtime.h"
#endif