My Project
Loading...
Searching...
No Matches
absyn.h File Reference

Abstract Syntaxic tree. More...

#include <inttypes.h>

Go to the source code of this file.

Data Structures

struct  Tag
 
struct  Var_Decl_
 
struct  Stmt_Exp_
 
struct  Stmt_Index_
 
struct  Stmt_Flow_
 
struct  Match
 
struct  Stmt_Code_
 
struct  Stmt_For_
 
struct  Stmt_Each_
 
struct  Stmt_Loop_
 
struct  Stmt_If_
 
struct  Handler_
 
struct  ParserHandler
 
struct  Stmt_Try_
 
struct  Stmt_PP_
 
struct  Stmt_Defer_
 
struct  Stmt_Using_
 
struct  Stmt_Import_
 
struct  Spread_Def_
 
struct  Stmt
 
union  Stmt::stmt_data
 
struct  Variable_
 variable declaration More...
 
struct  TmplArg
 
struct  Type_Decl_
 
struct  Arg_
 
struct  Exp_Dot
 a dot expression. More...
 
struct  Capture
 
struct  Exp_Lambda
 a lambda expression. More...
 
struct  Array_Sub_
 array_subscript. More...
 
struct  Exp_Array
 array expression. More...
 
struct  Range_
 range. More...
 
struct  Exp_Slice
 slice. More...
 
struct  Specialized
 
struct  AstString
 
struct  Exp_Decl
 
struct  gwint
 
struct  yyint
 a gwint with a larger int type for parsing More...
 
struct  Exp_Primary
 
union  Exp_Primary::prim_data
 
struct  Tmpl_
 
struct  Exp_Call_
 
struct  Exp_Cast
 
struct  Exp_Binary
 
struct  Exp_Postfix
 
struct  Exp_If
 
struct  UnaryNew
 
struct  Exp_Unary
 
struct  Exp_Named
 
struct  Exp
 
union  Exp::exp_data
 
struct  EnumValue
 
struct  Enum_Def_
 
struct  Upvalues
 
struct  Func_Base_
 
struct  Fptr_Def_
 
struct  Type_Def_
 
struct  Union_Def_
 
struct  Func_Def_
 
union  Func_Def_::func_def_data
 
struct  Trait_Def_
 
struct  Prim_Def_
 
struct  Section_
 
union  Section_::section_data
 
struct  Extend_Def_
 
struct  Class_Def_
 

Macros

#define AST_NEW(type, name, ...)
 
#define AST_FREE(type, name)
 
#define MK_TAG(a, b)
 
#define MK_STMT(_type, _loc, ...)
 
#define MK_STMT_PP(_type, _pos, ...)
 
#define MK_STMT_EXP(_pos, _exp)
 
#define MK_STMT_RETURN(_pos, _exp)
 
#define MK_VAR(a, b)
 
#define MK_TMPLARG_TD(a)
 
#define MK_TMPLARG_EXP(a)
 
#define GWINT(a, b)
 
#define MK_SECTION(_type, _target, _data, _loc)
 

Typedefs

typedef struct Class_Def_Class_Def
 
typedef struct Extend_Def_Extend_Def
 
typedef struct Func_Def_Func_Def
 
typedef struct Exp Exp
 
typedef struct Stmt Stmt
 
typedef struct Array_Sub_Array_Sub
 
typedef struct Fptr_Def_Fptr_Def
 
typedef struct Type_Decl_ Type_Decl
 
typedef struct SectionList * Ast
 
typedef struct Tag Tag
 
typedef struct Var_Decl_ Var_Decl
 
typedef struct Stmt_Exp_Stmt_Exp
 
typedef struct Stmt_Index_Stmt_Index
 
typedef struct Stmt_Flow_Stmt_Flow
 
typedef struct MatchStmt_Match
 
typedef struct Stmt_Code_Stmt_Code
 
typedef struct Handler_ Handler
 
typedef struct ParserHandler ParserHandler
 
typedef struct Stmt_Try_Stmt_Try
 
typedef struct Stmt_Using_Stmt_Using
 
typedef struct Stmt_Using_ UsingStmt
 
typedef Stmt_Using Using
 
typedef struct Stmt_Import_Stmt_Import
 
typedef struct Spread_Def_Spread_Def
 
typedef struct Stmt_For_Stmt_For
 
typedef struct Stmt_Each_Stmt_Each
 
typedef struct Stmt_Loop_Stmt_Loop
 
typedef struct Stmt_If_Stmt_If
 
typedef struct Stmt_PP_Stmt_PP
 
typedef struct Stmt_Defer_Stmt_Defer
 
typedef struct Variable_ Variable
 variable declaration
 
typedef struct TmplArg TmplArg
 
typedef Type_DeclTD
 
typedef struct Arg_ Arg
 
typedef struct Capture Capture
 
typedef struct Range_ Range
 range.
 
typedef struct Specialized Specialized
 
typedef struct Tmpl_ Tmpl
 
typedef struct Exp_Call_ Exp_Call
 
typedef ExpE
 
typedef struct EnumValue EnumValue
 
typedef struct Enum_Def_Enum_Def
 
typedef struct Upvalues Upvalues
 
typedef struct Func_Base_ Func_Base
 
typedef struct Type_Def_Type_Def
 
typedef struct Union_Def_Union_Def
 
typedef struct Trait_Def_Trait_Def
 
typedef struct Prim_Def_Prim_Def
 
typedef struct Section_ Section
 

Enumerations

enum  ae_pp_type {
  ae_pp_include , ae_pp_define , ae_pp_pragma , ae_pp_undef ,
  ae_pp_ifdef , ae_pp_ifndef , ae_pp_else , ae_pp_endif ,
  ae_pp_locale , ae_pp_nl
}
 
enum  ae_stmt_t {
  ae_stmt_exp , ae_stmt_while , ae_stmt_until , ae_stmt_for ,
  ae_stmt_each , ae_stmt_loop , ae_stmt_if , ae_stmt_code ,
  ae_stmt_break , ae_stmt_continue , ae_stmt_return , ae_stmt_try ,
  ae_stmt_retry , ae_stmt_match , ae_stmt_pp , ae_stmt_defer ,
  ae_stmt_spread , ae_stmt_using , ae_stmt_import
}
 
enum  tmplarg_t { tmplarg_td , tmplarg_exp }
 
enum  fbflag
 
enum  ae_exp_t {
  ae_exp_decl , ae_exp_binary , ae_exp_unary , ae_exp_primary ,
  ae_exp_cast , ae_exp_post , ae_exp_call , ae_exp_array ,
  ae_exp_slice , ae_exp_if , ae_exp_dot , ae_exp_lambda ,
  ae_exp_td , ae_exp_named
}
 
enum  ae_Exp_Meta { ae_meta_var , ae_meta_value , ae_meta_protect }
 
enum  ae_prim_t {
  ae_prim_id , ae_prim_num , ae_prim_float , ae_prim_str ,
  ae_prim_array , ae_prim_range , ae_prim_dict , ae_prim_hack ,
  ae_prim_char , ae_prim_nil , ae_prim_interp , ae_prim_perform ,
  ae_prim_locale
}
 
enum  gwint_type { gwint_decimal , gwint_binary , gwint_hexa , gwint_octal }
 
enum  unary_type { unary_exp , unary_td , unary_code }
 
enum  exp_state { exp_state_meta , exp_state_prot , exp_state_addr , exp_state_use }
 
enum  exp_comptime { comptime_no , comptime_yes , comptime_need }
 
enum  ae_section_t {
  ae_section_stmt , ae_section_func , ae_section_class , ae_section_trait ,
  ae_section_extend , ae_section_enum , ae_section_union , ae_section_fptr ,
  ae_section_type , ae_section_primitive
}
 
enum  cflag { cflag_none , cflag_struct }
 

Functions

 MK_VECTOR_TYPE (Tag, tag)
 
static Stmtstmt_self (const void *data)
 
ANEW AST_NEW (Stmt *, stmt, const ae_stmt_t, const loc_t)
 
ANN ANEW AST_NEW (Stmt *, stmt_exp, const ae_stmt_t, Exp *, const loc_t)
 
ANN ANEW AST_NEW (Stmt *, stmt_code, StmtList *, const loc_t)
 
ANN ANEW AST_NEW (Stmt *, stmt_if, Exp *, Stmt *, const loc_t)
 
ANEW ANN AST_NEW (Stmt *, stmt_flow, const ae_stmt_t, Exp *, Stmt *, const bool, const loc_t)
 
ANEW AST_NEW (Stmt *, stmt_for, Stmt *, Stmt *, Exp *, Stmt *, const loc_t)
 
ANEW ANN AST_NEW (Stmt *, stmt_each, struct Symbol_ *, Exp *, Stmt *, const loc_t)
 
ANEW ANN AST_NEW (Stmt *, stmt_loop, Exp *, Stmt *, const loc_t)
 
ANEW ANN2 (1, 3) AST_NEW(Stmt *
 
ANEW ANN AST_NEW (Stmt *, stmt_defer, Stmt *, const loc_t)
 
ANEW ANN AST_NEW (Stmt *, stmt_try, Stmt *, HandlerList *)
 
ANN void free_stmt (MemPool p, Stmt *)
 
ANN void free_variablelist (MemPool p, VariableList *)
 
ANEW ANN AST_NEW (Type_Decl *, type_decl, const Symbol, const loc_t)
 
ANN void free_type_decl (MemPool p, Type_Decl *)
 
static ANN uint32_t tmplarg_has_const (const TmplArgList *tl)
 
static ANN uint32_t tmplarg_ntypes (const TmplArgList *tl)
 
enum fbflag __attribute__ ((packed))
 
 ANN2 (1, 2, 4) AST_NEW(Exp *
 
 AST_NEW (Exp *, exp_lambda2, const Symbol xid, ArgList *args, Exp *exp, const loc_t)
 
ANEW AST_NEW (Array_Sub, array_sub, Exp *)
 
 ANN2 (1) Array_Sub prepend_array_sub(const Array_Sub
 
Exp *ANN void free_array_sub (MemPool p, Array_Sub)
 
ANEW ANN AST_NEW (Exp *, exp_array, Exp *, const Array_Sub, const loc_t)
 
 AST_NEW (Range *, range, Exp *, Exp *)
 
ANEW ANN AST_NEW (Exp *, exp_slice, Exp *, Range *, const loc_t)
 
ANN void free_specialized_list (MemPool p, SpecializedList *)
 
ANN void free_tmplarg_list (MemPool p, TmplArgList *)
 
ANN void free_arg_list (MemPool p, ArgList *)
 
ANN ANEW AST_NEW (Tmpl *, tmpl, SpecializedList *)
 
ANN ANEW AST_NEW (Tmpl *, tmpl_call, TmplArgList *)
 
ANN void free_tmpl (MemPool p, Tmpl *)
 
static ANN bool is_spread_tmpl (const Tmpl *tmpl)
 
static bool tmpl_base (const Tmpl *a)
 
 AST_NEW (Exp *, exp_named, Exp *exp, const Tag tag, const loc_t loc)
 
static ANN int exp_getuse (const Exp *e)
 
static ANN void exp_setuse (Exp *e, const bool val)
 
static ANN int exp_getvar (const Exp *e)
 
static ANN void exp_setvar (Exp *e, const bool val)
 
static ANN int exp_getprot (const Exp *e)
 
static ANN void exp_setprot (Exp *e, const bool val)
 
static ANN int exp_getmeta (const Exp *e)
 
static ANN void exp_setmeta (Exp *e, const bool val)
 
static ANN m_str exp_access (const Exp *e)
 
static Expexp_self (const void *data)
 
static Exp_Primaryprim_self (const void *data)
 
static Expprim_exp (const void *data)
 
static loc_t prim_pos (const void *data)
 
ANEW ANN AST_NEW (Exp *, prim_id, struct Symbol_ *, const loc_t)
 
ANEW AST_NEW (Exp *, prim_int, const m_uint, const loc_t)
 
ANEW AST_NEW (Exp *, prim_float, const m_float, const loc_t)
 
ANEW ANN AST_NEW (Exp *, prim_string, const m_str, const uint16_t delim, const loc_t)
 
ANEW ANN AST_NEW (Exp *, prim_array, const Array_Sub, const loc_t)
 
ANEW ANN AST_NEW (Exp *, prim_range, Range *, const loc_t)
 
ANEW AST_NEW (Exp *, prim_dict, Exp *, const loc_t)
 
ANEW AST_NEW (Exp *, prim_hack, Exp *, const loc_t)
 
ANEW ANN AST_NEW (Exp *, prim_char, const m_str, const loc_t)
 
ANEW AST_NEW (Exp *, prim_nil, const loc_t)
 
ANEW ANN AST_NEW (Exp *, prim_interp, Exp *exp, const loc_t)
 
ANEW ANN AST_NEW (Exp *, exp_decl, Type_Decl *, const Var_Decl *, const loc_t)
 
ANEW ANN AST_NEW (Exp *, exp_binary, Exp *, const Symbol, Exp *, const loc_t)
 
ANEW ANN AST_NEW (Exp *, exp_post, Exp *, const Symbol, const loc_t)
 
ANEW AST_NEW (Exp *, exp_call, Exp *, Exp *args, const loc_t)
 
ANEW ANN AST_NEW (Exp *, exp_cast, Type_Decl *, Exp *, const loc_t)
 
ANEW AST_NEW (Exp *, exp_if, Exp *, Exp *, Exp *, const loc_t)
 
ANEW ANN AST_NEW (Exp *, exp_dot, Exp *, const Tag tag, const loc_t)
 
ANEW ANN AST_NEW (Exp *, exp_unary, const Symbol, Exp *, const loc_t)
 
ANEW ANN2 (1, 2, 3) AST_NEW(Exp *
 
ANEW ANN AST_NEW (Exp *, exp_unary3, const Symbol, StmtList *, const loc_t)
 
ANN void free_stmt_list (MemPool, StmtList *)
 
ANEW ANN AST_NEW (Exp *, exp_td, Type_Decl *, const loc_t)
 
static uint32_t exp_count (Exp *exp)
 
static Exptake_exp (Exp *exp, const uint32_t n)
 
ANN void free_exp (MemPool p, Exp *)
 
ANEW AST_NEW (Enum_Def, enum_def, EnumValueList *, struct Symbol_ *, const loc_t)
 
ANN void free_enum_def (MemPool p, Enum_Def)
 
 AST_NEW (Func_Base *, func_base, Type_Decl *, const Symbol, ArgList *, const ae_flag flag, const loc_t)
 
ANEW ANN AST_NEW (Fptr_Def, fptr_def, Func_Base *)
 
ANN void free_fptr_def (MemPool p, Fptr_Def)
 
ANEW ANN AST_NEW (Type_Def, type_def, Type_Decl *, const Symbol, const loc_t)
 
ANN void free_type_def (MemPool p, Type_Def)
 
ANEW ANN AST_NEW (Union_Def, union_def, VariableList *, const loc_t)
 
ANN void free_union_def (MemPool p, Union_Def)
 
ANEW AST_NEW (Func_Def, func_def, Func_Base *, StmtList *)
 
ANN void free_func_base (MemPool p, Func_Base *)
 
ANN void free_func_def (MemPool p, Func_Def)
 
ANN ANEW Trait_Def new_trait_def (MemPool p, const ae_flag, const Symbol, const Ast, const loc_t)
 
ANN void free_trait_def (MemPool p, Trait_Def)
 
 AST_NEW (Prim_Def, prim_def, const Symbol name, const m_uint size, const loc_t, const ae_flag flag)
 
ANN void free_prim_def (MemPool p, Prim_Def)
 
static bool is_prim (const Exp *e)
 
static bool is_prim_int (const Exp *e)
 
static bool is_prim_float (const Exp *e)
 
ANEW ANN AST_NEW (Section *, section_stmt_list, StmtList *)
 
ANEW ANN AST_NEW (Section *, section_func_def, const Func_Def)
 
ANEW ANN AST_NEW (Section *, section_class_def, const Class_Def)
 
ANEW ANN AST_NEW (Section *, section_trait_def, const Trait_Def)
 
ANEW ANN AST_NEW (Section *, section_extend_def, const Extend_Def)
 
ANEW ANN AST_NEW (Section *, section_enum_def, const Enum_Def)
 
ANEW ANN AST_NEW (Section *, section_union_def, const Union_Def)
 
ANEW ANN AST_NEW (Section *, section_fptr_def, const Fptr_Def)
 
ANEW ANN AST_NEW (Section *, section_type_def, const Type_Def)
 
ANEW Extend_Def new_extend_def (MemPool p, Type_Decl *const, TagList *const)
 
ANN void free_extend_def (MemPool p, Extend_Def)
 
static ANN int cflag (const Class_Def c, const enum cflag flag)
 
ANEW Class_Def new_class_def (MemPool p, const ae_flag, const Tag, Type_Decl *, const Ast)
 
ANN void free_class_def (MemPool p, Class_Def)
 
ANN void free_ast (MemPool p, Ast)
 

Variables

typedef __attribute__
 
ANEW stmt_pp
 
ANEW enum ae_pp_type type const m_str const loc_t
 
 fbflag_none = 1 << 0
 
 fbflag_op = 1 << 1
 
 fbflag_unary = 1 << 3
 
 fbflag_postfix = 1 << 4
 
 fbflag_internal = 1 << 5
 
 fbflag_lambda = 1 << 6
 
 fbflag_default = 1 << 7
 
 fbflag_locale = 1 << 8
 
 exp_lambda
 
const Symbol
 
ANEW prim_perform
 
ANEW exp_unary2
 
ANEW const Type_Decl Expexp
 

Detailed Description

Abstract Syntaxic tree.

Definition in file absyn.h.

Macro Definition Documentation

◆ AST_FREE

#define AST_FREE ( type,
name )
Value:
void free_##name(MemPool p NUSED, type a NUSED)

Definition at line 11 of file absyn.h.

◆ AST_NEW

#define AST_NEW ( type,
name,
... )
Value:
type new_##name(MemPool p, __VA_ARGS__)

Definition at line 9 of file absyn.h.

◆ GWINT

#define GWINT ( a,
b )
Value:
((struct gwint){ .num = a, .int_type = b})
Definition absyn.h:451

Definition at line 455 of file absyn.h.

◆ MK_SECTION

#define MK_SECTION ( _type,
_target,
_data,
_loc )
Value:
(Section){ .section_type = ae_section_##_type, .d = { ._target = _data }, .loc = _loc }
struct Section_ Section

Definition at line 823 of file absyn.h.

◆ MK_STMT

#define MK_STMT ( _type,
_loc,
... )
Value:
(Stmt){ .stmt_type = _type, \
.d = { __VA_ARGS__ }, .loc = _loc }
struct Stmt Stmt
Definition absyn.h:17

Definition at line 212 of file absyn.h.

212#define MK_STMT(_type, _loc, ...) (Stmt){ .stmt_type = _type, \
213 .d = { __VA_ARGS__ }, .loc = _loc }

◆ MK_STMT_EXP

#define MK_STMT_EXP ( _pos,
_exp )
Value:
MK_STMT(ae_stmt_exp, _pos, .stmt_exp = { .val = _exp })
@ ae_stmt_exp
Definition absyn.h:159
#define MK_STMT(_type, _loc,...)
Definition absyn.h:212

Definition at line 215 of file absyn.h.

◆ MK_STMT_PP

#define MK_STMT_PP ( _type,
_pos,
... )
Value:
MK_STMT(ae_stmt_pp, _pos, .stmt_pp = { .pp_type = ae_pp_##_type, __VA_ARGS__ })
@ ae_stmt_pp
Definition absyn.h:173
ANEW stmt_pp
Definition absyn.h:235

Definition at line 214 of file absyn.h.

◆ MK_STMT_RETURN

#define MK_STMT_RETURN ( _pos,
_exp )
Value:
MK_STMT(ae_stmt_return, _pos, .stmt_exp = { .val = _exp })
@ ae_stmt_return
Definition absyn.h:169

Definition at line 216 of file absyn.h.

◆ MK_TAG

#define MK_TAG ( a,
b )
Value:
(Tag){ .sym = (a), .loc = (b) }
struct Tag Tag

Definition at line 29 of file absyn.h.

◆ MK_TMPLARG_EXP

#define MK_TMPLARG_EXP ( a)
Value:
(TmplArg) { \
.type = tmplarg_exp, \
.d = { .exp = (a) }, \
}
struct TmplArg TmplArg
@ tmplarg_exp
Definition absyn.h:255

Definition at line 271 of file absyn.h.

271#define MK_TMPLARG_EXP(a) \
272 (TmplArg) { \
273 .type = tmplarg_exp, \
274 .d = { .exp = (a) }, \
275 }

◆ MK_TMPLARG_TD

#define MK_TMPLARG_TD ( a)
Value:
(TmplArg) { \
.type = tmplarg_td, \
.d = { .td = (a) }, \
}
@ tmplarg_td
Definition absyn.h:254

Definition at line 266 of file absyn.h.

266#define MK_TMPLARG_TD(a) \
267 (TmplArg) { \
268 .type = tmplarg_td, \
269 .d = { .td = (a) }, \
270 }

◆ MK_VAR

#define MK_VAR ( a,
b )
Value:
(Variable){ .td = (a), .vd = (b) }
struct Variable_ Variable
variable declaration

Definition at line 248 of file absyn.h.

Typedef Documentation

◆ Arg

typedef struct Arg_ Arg

◆ Array_Sub

typedef struct Array_Sub_* Array_Sub

Definition at line 18 of file absyn.h.

◆ Ast

typedef struct SectionList* Ast

Definition at line 23 of file absyn.h.

◆ Capture

typedef struct Capture Capture

◆ Class_Def

typedef struct Class_Def_* Class_Def

Definition at line 13 of file absyn.h.

◆ E

typedef Exp* E

Definition at line 589 of file absyn.h.

◆ Enum_Def

typedef struct Enum_Def_ * Enum_Def

◆ EnumValue

typedef struct EnumValue EnumValue

◆ Exp

typedef struct Exp Exp

Definition at line 16 of file absyn.h.

◆ Exp_Call

typedef struct Exp_Call_ Exp_Call

◆ Extend_Def

typedef struct Extend_Def_* Extend_Def

Definition at line 14 of file absyn.h.

◆ Fptr_Def

typedef struct Fptr_Def_* Fptr_Def

Definition at line 19 of file absyn.h.

◆ Func_Base

typedef struct Func_Base_ Func_Base

◆ Func_Def

typedef struct Func_Def_* Func_Def

Definition at line 15 of file absyn.h.

◆ Handler

typedef struct Handler_ Handler

◆ ParserHandler

typedef struct ParserHandler ParserHandler

◆ Prim_Def

typedef struct Prim_Def_ * Prim_Def

◆ Range

typedef struct Range_ Range

range.

[12:12]

or

[1:]

or

[:12]

◆ Section

typedef struct Section_ Section

◆ Specialized

typedef struct Specialized Specialized

◆ Spread_Def

typedef struct Spread_Def_ * Spread_Def

◆ Stmt

typedef struct Stmt Stmt

Definition at line 17 of file absyn.h.

◆ Stmt_Code

typedef struct Stmt_Code_ * Stmt_Code

◆ Stmt_Defer

typedef struct Stmt_Defer_* Stmt_Defer

Definition at line 185 of file absyn.h.

◆ Stmt_Each

typedef struct Stmt_Each_* Stmt_Each

Definition at line 181 of file absyn.h.

◆ Stmt_Exp

typedef struct Stmt_Exp_ * Stmt_Exp

◆ Stmt_Flow

typedef struct Stmt_Flow_ * Stmt_Flow

◆ Stmt_For

typedef struct Stmt_For_* Stmt_For

Definition at line 180 of file absyn.h.

◆ Stmt_If

typedef struct Stmt_If_* Stmt_If

Definition at line 183 of file absyn.h.

◆ Stmt_Import

typedef struct Stmt_Import_ * Stmt_Import

◆ Stmt_Index

typedef struct Stmt_Index_ * Stmt_Index

◆ Stmt_Loop

typedef struct Stmt_Loop_* Stmt_Loop

Definition at line 182 of file absyn.h.

◆ Stmt_Match

typedef struct Match * Stmt_Match

◆ Stmt_PP

typedef struct Stmt_PP_* Stmt_PP

Definition at line 184 of file absyn.h.

◆ Stmt_Try

typedef struct Stmt_Try_ * Stmt_Try

◆ Stmt_Using

typedef struct Stmt_Using_ * Stmt_Using

◆ Tag

typedef struct Tag Tag

◆ TD

typedef Type_Decl* TD

Definition at line 288 of file absyn.h.

◆ Tmpl

typedef struct Tmpl_ Tmpl

◆ TmplArg

typedef struct TmplArg TmplArg

◆ Trait_Def

typedef struct Trait_Def_ * Trait_Def

◆ Type_Decl

typedef struct Type_Decl_ Type_Decl

Definition at line 20 of file absyn.h.

◆ Type_Def

typedef struct Type_Def_* Type_Def

Definition at line 755 of file absyn.h.

◆ Union_Def

typedef struct Union_Def_ * Union_Def

◆ Upvalues

typedef struct Upvalues Upvalues

◆ Using

typedef Stmt_Using Using

Definition at line 142 of file absyn.h.

◆ UsingStmt

typedef struct Stmt_Using_ UsingStmt

Definition at line 141 of file absyn.h.

◆ Var_Decl

typedef struct Var_Decl_ Var_Decl

◆ Variable

typedef struct Variable_ Variable

variable declaration

Enumeration Type Documentation

◆ ae_Exp_Meta

Enumerator
ae_meta_var 
ae_meta_value 
ae_meta_protect 

Definition at line 415 of file absyn.h.

ae_Exp_Meta
Definition absyn.h:415
@ ae_meta_var
Definition absyn.h:415
@ ae_meta_value
Definition absyn.h:415
@ ae_meta_protect
Definition absyn.h:415

◆ ae_exp_t

enum ae_exp_t
Enumerator
ae_exp_decl 
ae_exp_binary 
ae_exp_unary 
ae_exp_primary 
ae_exp_cast 
ae_exp_post 
ae_exp_call 
ae_exp_array 
ae_exp_slice 
ae_exp_if 
ae_exp_dot 
ae_exp_lambda 
ae_exp_td 
ae_exp_named 

Definition at line 399 of file absyn.h.

399 {
409 ae_exp_if,
412 ae_exp_td,
414} ae_exp_t;
ae_exp_t
Definition absyn.h:399
@ ae_exp_unary
Definition absyn.h:402
@ ae_exp_binary
Definition absyn.h:401
@ ae_exp_post
Definition absyn.h:405
@ ae_exp_dot
Definition absyn.h:410
@ ae_exp_call
Definition absyn.h:406
@ ae_exp_decl
Definition absyn.h:400
@ ae_exp_primary
Definition absyn.h:403
@ ae_exp_if
Definition absyn.h:409
@ ae_exp_lambda
Definition absyn.h:411
@ ae_exp_td
Definition absyn.h:412
@ ae_exp_cast
Definition absyn.h:404
@ ae_exp_slice
Definition absyn.h:408
@ ae_exp_array
Definition absyn.h:407
@ ae_exp_named
Definition absyn.h:413

◆ ae_pp_type

enum ae_pp_type
Enumerator
ae_pp_include 
ae_pp_define 
ae_pp_pragma 
ae_pp_undef 
ae_pp_ifdef 
ae_pp_ifndef 
ae_pp_else 
ae_pp_endif 
ae_pp_locale 
ae_pp_nl 

Definition at line 109 of file absyn.h.

109 {
120};
@ ae_pp_pragma
Definition absyn.h:112
@ ae_pp_ifdef
Definition absyn.h:114
@ ae_pp_endif
Definition absyn.h:117
@ ae_pp_else
Definition absyn.h:116
@ ae_pp_include
Definition absyn.h:110
@ ae_pp_define
Definition absyn.h:111
@ ae_pp_locale
Definition absyn.h:118
@ ae_pp_ifndef
Definition absyn.h:115
@ ae_pp_undef
Definition absyn.h:113
@ ae_pp_nl
Definition absyn.h:119

◆ ae_prim_t

enum ae_prim_t
Enumerator
ae_prim_id 
ae_prim_num 
ae_prim_float 
ae_prim_str 
ae_prim_array 
ae_prim_range 
ae_prim_dict 
ae_prim_hack 
ae_prim_char 
ae_prim_nil 
ae_prim_interp 
ae_prim_perform 
ae_prim_locale 

Definition at line 422 of file absyn.h.

422 {
436} ae_prim_t;
ae_prim_t
Definition absyn.h:422
@ ae_prim_nil
Definition absyn.h:432
@ ae_prim_locale
Definition absyn.h:435
@ ae_prim_array
Definition absyn.h:427
@ ae_prim_id
Definition absyn.h:423
@ ae_prim_float
Definition absyn.h:425
@ ae_prim_hack
Definition absyn.h:430
@ ae_prim_perform
Definition absyn.h:434
@ ae_prim_num
Definition absyn.h:424
@ ae_prim_interp
Definition absyn.h:433
@ ae_prim_char
Definition absyn.h:431
@ ae_prim_str
Definition absyn.h:426
@ ae_prim_range
Definition absyn.h:428
@ ae_prim_dict
Definition absyn.h:429

◆ ae_section_t

Enumerator
ae_section_stmt 
ae_section_func 
ae_section_class 
ae_section_trait 
ae_section_extend 
ae_section_enum 
ae_section_union 
ae_section_fptr 
ae_section_type 
ae_section_primitive 

Definition at line 824 of file absyn.h.

824 {
ae_section_t
Definition absyn.h:824
@ ae_section_primitive
Definition absyn.h:834
@ ae_section_class
Definition absyn.h:827
@ ae_section_enum
Definition absyn.h:830
@ ae_section_union
Definition absyn.h:831
@ ae_section_fptr
Definition absyn.h:832
@ ae_section_func
Definition absyn.h:826
@ ae_section_type
Definition absyn.h:833
@ ae_section_stmt
Definition absyn.h:825
@ ae_section_extend
Definition absyn.h:829
@ ae_section_trait
Definition absyn.h:828

◆ ae_stmt_t

enum ae_stmt_t
Enumerator
ae_stmt_exp 
ae_stmt_while 
ae_stmt_until 
ae_stmt_for 
ae_stmt_each 
ae_stmt_loop 
ae_stmt_if 
ae_stmt_code 
ae_stmt_break 
ae_stmt_continue 
ae_stmt_return 
ae_stmt_try 
ae_stmt_retry 
ae_stmt_match 
ae_stmt_pp 
ae_stmt_defer 
ae_stmt_spread 
ae_stmt_using 
ae_stmt_import 

Definition at line 158 of file absyn.h.

158 {
178} ae_stmt_t;
ae_stmt_t
Definition absyn.h:158
@ ae_stmt_continue
Definition absyn.h:168
@ ae_stmt_spread
Definition absyn.h:175
@ ae_stmt_loop
Definition absyn.h:164
@ ae_stmt_while
Definition absyn.h:160
@ ae_stmt_code
Definition absyn.h:166
@ ae_stmt_match
Definition absyn.h:172
@ ae_stmt_for
Definition absyn.h:162
@ ae_stmt_if
Definition absyn.h:165
@ ae_stmt_until
Definition absyn.h:161
@ ae_stmt_import
Definition absyn.h:177
@ ae_stmt_each
Definition absyn.h:163
@ ae_stmt_break
Definition absyn.h:167
@ ae_stmt_try
Definition absyn.h:170
@ ae_stmt_defer
Definition absyn.h:174
@ ae_stmt_retry
Definition absyn.h:171
@ ae_stmt_using
Definition absyn.h:176

◆ cflag

enum cflag
Enumerator
cflag_none 
cflag_struct 

Definition at line 874 of file absyn.h.

874 {
877};
@ cflag_struct
Definition absyn.h:876
@ cflag_none
Definition absyn.h:875

◆ exp_comptime

Enumerator
comptime_no 
comptime_yes 
comptime_need 

Definition at line 553 of file absyn.h.

553 {
557};
@ comptime_yes
Definition absyn.h:555
@ comptime_need
Definition absyn.h:556
@ comptime_no
Definition absyn.h:554

◆ exp_state

enum exp_state
Enumerator
exp_state_meta 
exp_state_prot 
exp_state_addr 
exp_state_use 

Definition at line 546 of file absyn.h.

546 {
547 exp_state_meta, // ae_meta_value
548 exp_state_prot, // ae_meta_protect
551};
@ exp_state_meta
Definition absyn.h:547
@ exp_state_use
Definition absyn.h:550
@ exp_state_addr
Definition absyn.h:549
@ exp_state_prot
Definition absyn.h:548

◆ fbflag

enum fbflag

Definition at line 317 of file absyn.h.

317 {
318 fbflag_none = 1 << 0,
319 fbflag_op = 1 << 1,
320 fbflag_unary = 1 << 3,
321 fbflag_postfix = 1 << 4,
322 fbflag_internal = 1 << 5,
323 fbflag_lambda = 1 << 6,
324 fbflag_default = 1 << 7,
325 fbflag_locale = 1 << 8,
326} __attribute__((packed));
fbflag_default
Definition absyn.h:6
fbflag_locale
Definition absyn.h:7
fbflag_op
Definition absyn.h:1
fbflag_none
Definition absyn.h:0
typedef __attribute__
fbflag_postfix
Definition absyn.h:3
fbflag_lambda
Definition absyn.h:5
fbflag_internal
Definition absyn.h:4
fbflag_unary
Definition absyn.h:2

◆ gwint_type

enum gwint_type
Enumerator
gwint_decimal 
gwint_binary 
gwint_hexa 
gwint_octal 

Definition at line 444 of file absyn.h.

444 {
449};
@ gwint_hexa
Definition absyn.h:447
@ gwint_octal
Definition absyn.h:448
@ gwint_binary
Definition absyn.h:446
@ gwint_decimal
Definition absyn.h:445

◆ tmplarg_t

enum tmplarg_t
Enumerator
tmplarg_td 
tmplarg_exp 

Definition at line 253 of file absyn.h.

253 {
256};

◆ unary_type

enum unary_type
Enumerator
unary_exp 
unary_td 
unary_code 

Definition at line 522 of file absyn.h.

@ unary_code
Definition absyn.h:522
@ unary_exp
Definition absyn.h:522
@ unary_td
Definition absyn.h:522

Function Documentation

◆ __attribute__()

enum fbflag __attribute__ ( (packed) )

◆ ANN2() [1/4]

ANN2 ( 1 ) const

◆ ANN2() [2/4]

ANEW ANN2 ( 1 ,
2 ,
3  )

◆ ANN2() [3/4]

ANN2 ( 1 ,
2 ,
4  )

◆ ANN2() [4/4]

ANEW ANN2 ( 1 ,
3  )

◆ AST_NEW() [1/56]

ANEW AST_NEW ( Array_Sub ,
array_sub ,
Exp * exp )

Definition at line 10 of file ast_new.c.

10 {
11 Array_Sub a = mp_calloc(p, Array_Sub);
12 a->exp = exp;
13 a->depth = 1;
14 return a;
15}
ANEW const Type_Decl Exp * exp
Definition absyn.h:680
array_subscript.
Definition absyn.h:352
uint16_t depth
Definition absyn.h:355
Exp * exp
Definition absyn.h:353

◆ AST_NEW() [2/56]

ANEW AST_NEW ( Enum_Def ,
enum_def ,
EnumValueList * list,
struct Symbol_ * xid,
const loc_t loc )

Definition at line 401 of file ast_new.c.

402 {
403 Enum_Def a = mp_calloc(p, Enum_Def);
404 a->tag = MK_TAG(xid, loc);
405 a->list = list;
406 return a;
407}
#define MK_TAG(a, b)
Definition absyn.h:29
EnumValueList * list
Definition absyn.h:715
Tag tag
Definition absyn.h:714

◆ AST_NEW() [3/56]

ANEW ANN AST_NEW ( Exp * ,
exp_array ,
Exp * base,
const Array_Sub array,
const loc_t loc )

Definition at line 61 of file ast_new.c.

62 {
63 Exp* a = new_exp(p, ae_exp_array, loc);
64 a->d.exp_array.base = base;
65 a->d.exp_array.array = array;
66 return a;
67}
Exp * base
Definition absyn.h:363
Array_Sub array
Definition absyn.h:364
Definition absyn.h:559
union Exp::exp_data d
Exp_Array exp_array
Definition absyn.h:570

◆ AST_NEW() [4/56]

ANEW ANN AST_NEW ( Exp * ,
exp_binary ,
Exp * lhs,
const Symbol op,
Exp * rhs,
const loc_t loc )

Definition at line 83 of file ast_new.c.

84 {
85 Exp* a = new_exp(p, ae_exp_binary, loc);
86 exp_setmeta(a, 1);
87 a->d.exp_binary.lhs = lhs;
88 a->d.exp_binary.op = op;
89 a->d.exp_binary.rhs = rhs;
90 return a;
91}
static ANN void exp_setmeta(Exp *e, const bool val)
Definition absyn.h:628
Symbol op
Definition absyn.h:511
Exp * rhs
Definition absyn.h:510
Exp * lhs
Definition absyn.h:509
Exp_Binary exp_binary
Definition absyn.h:565

◆ AST_NEW() [5/56]

ANEW AST_NEW ( Exp * ,
exp_call ,
Exp * base,
Exp * args,
const loc_t loc )

Definition at line 304 of file ast_new.c.

305 {
306 Exp* a = new_exp(p, ae_exp_call, loc);
307 exp_setmeta(a, 1);
308 a->d.exp_call.func = base;
309 a->d.exp_call.args = args;
310 return a;
311}
Exp * args
Definition absyn.h:499
Exp * func
Definition absyn.h:498
Exp_Call exp_call
Definition absyn.h:567

◆ AST_NEW() [6/56]

ANEW ANN AST_NEW ( Exp * ,
exp_cast ,
Type_Decl * td,
Exp * exp,
const loc_t loc )

Definition at line 93 of file ast_new.c.

93 {
94 Exp* a = new_exp(p, ae_exp_cast, loc);
95 exp_setmeta(a, 1);
96 a->d.exp_cast.td = td;
97 a->d.exp_cast.exp = exp;
98 return a;
99}
Exp * exp
Definition absyn.h:506
Type_Decl * td
Definition absyn.h:505
Exp_Cast exp_cast
Definition absyn.h:566

◆ AST_NEW() [7/56]

ANEW ANN AST_NEW ( Exp * ,
exp_decl ,
Type_Decl * td,
const Var_Decl * vd,
const loc_t loc )

Definition at line 76 of file ast_new.c.

77 {
78 Exp* a = new_exp(p, ae_exp_decl, loc);
79 a->d.exp_decl.var = MK_VAR(td, *vd);
80 return a;
81}
#define MK_VAR(a, b)
Definition absyn.h:248
Variable var
Definition absyn.h:439
Exp_Decl exp_decl
Definition absyn.h:563

◆ AST_NEW() [8/56]

ANEW ANN AST_NEW ( Exp * ,
exp_dot ,
Exp * base,
const Tag tag,
const loc_t loc )

Definition at line 313 of file ast_new.c.

314 {
315 Exp* a = new_exp(p, ae_exp_dot, loc);
316 a->d.exp_dot.base = base;
317 a->d.exp_dot.var.tag = tag;
318 return a;
319}
Var_Decl var
Definition absyn.h:330
Exp * base
Definition absyn.h:331
Tag tag
Definition absyn.h:34
Exp_Dot exp_dot
Definition absyn.h:569

◆ AST_NEW() [9/56]

ANEW AST_NEW ( Exp * ,
exp_if ,
Exp * cond,
Exp * if_exp,
Exp * else_exp,
const loc_t loc )

Definition at line 250 of file ast_new.c.

251 {
252 Exp* a = new_exp(p, ae_exp_if, loc);
253 enum exp_state state =
254 (!(!exp_getmeta(if_exp ?: cond)) && !exp_getmeta(else_exp)) ? 0 : 1;
255 exp_setmeta(a, state);
256 a->d.exp_if.cond = cond;
257 a->d.exp_if.if_exp = if_exp;
258 a->d.exp_if.else_exp = else_exp;
259 return a;
260}
exp_state
Definition absyn.h:546
static ANN int exp_getmeta(const Exp *e)
Definition absyn.h:624
Exp * cond
Definition absyn.h:518
Exp * if_exp
Definition absyn.h:519
Exp * else_exp
Definition absyn.h:520
Exp_If exp_if
Definition absyn.h:568

◆ AST_NEW() [10/56]

AST_NEW ( Exp * ,
exp_lambda2 ,
const Symbol xid,
ArgList * args,
Exp * exp,
const loc_t loc )

Definition at line 49 of file ast_new.c.

50 {
51 Exp* a = new_exp(p, ae_exp_lambda, loc);
52 Func_Base *base = new_func_base(p, NULL, xid, args, ae_flag_none, loc);
53 base->fbflag |= fbflag_lambda;
54 StmtList *code = new_stmtlist(p, 1);
55 Stmt stmt = MK_STMT_RETURN(loc, exp);
56 stmtlist_set(code, 0, stmt);
57 a->d.exp_lambda.def = new_func_def(p, base, code);
58 return a;
59}
#define MK_STMT_RETURN(_pos, _exp)
Definition absyn.h:216
Func_Def new_func_def(MemPool p, Func_Base *base, StmtList *code)
Definition ast_new.c:268
@ ae_flag_none
Definition flags.h:21
return NULL
Definition macro.c:41
Func_Def def
Definition absyn.h:344
enum fbflag fbflag
Definition absyn.h:739
Definition absyn.h:187
Exp_Lambda exp_lambda
Definition absyn.h:572

◆ AST_NEW() [11/56]

AST_NEW ( Exp * ,
exp_named ,
Exp * exp,
const Tag tag,
const loc_t loc )

Definition at line 115 of file ast_new.c.

115 {
116 Exp* a = new_exp(p, ae_exp_named, loc);
117 a->d.exp_named.exp = exp;
118 a->d.exp_named.tag = tag;
119 return a;
120}
Tag tag
Definition absyn.h:540
Exp * exp
Definition absyn.h:539
Exp_Named exp_named
Definition absyn.h:574

◆ AST_NEW() [12/56]

ANEW ANN AST_NEW ( Exp * ,
exp_post ,
Exp * exp,
const Symbol op,
const loc_t loc )

Definition at line 101 of file ast_new.c.

102 {
103 Exp* a = new_exp(p, ae_exp_post, loc);
104 a->d.exp_post.exp = exp;
105 a->d.exp_post.op = op;
106 return a;
107}
Exp * exp
Definition absyn.h:515
Symbol op
Definition absyn.h:514
Exp_Postfix exp_post
Definition absyn.h:561

◆ AST_NEW() [13/56]

ANEW ANN AST_NEW ( Exp * ,
exp_slice ,
Exp * base,
Range * range,
const loc_t loc )

Definition at line 69 of file ast_new.c.

69 {
70 Exp* a = new_exp(p, ae_exp_slice, loc);
71 a->d.exp_slice.base = base;
72 a->d.exp_slice.range = range;
73 return a;
74}
Range * range
Definition absyn.h:381
Exp * base
Definition absyn.h:380
Exp_Slice exp_slice
Definition absyn.h:571

◆ AST_NEW() [14/56]

ANEW ANN AST_NEW ( Exp * ,
exp_td ,
Type_Decl * td,
const loc_t loc )

Definition at line 109 of file ast_new.c.

109 {
110 Exp* a = new_exp(p, ae_exp_td, loc);
111 a->d.exp_td = td;
112 return a;
113}
Type_Decl * exp_td
Definition absyn.h:573

◆ AST_NEW() [15/56]

ANEW ANN AST_NEW ( Exp * ,
exp_unary ,
const Symbol oper,
Exp * exp,
const loc_t loc )

Definition at line 222 of file ast_new.c.

223 {
224 Exp* a = new_exp_unary_base(p, oper, loc);
226 a->d.exp_unary.exp = exp;
228 return a;
229}
enum unary_type unary_type
Definition absyn.h:535
Exp * exp
Definition absyn.h:530
Exp_Unary exp_unary
Definition absyn.h:564

◆ AST_NEW() [16/56]

ANEW ANN AST_NEW ( Exp * ,
exp_unary3 ,
const Symbol oper,
StmtList * code,
const loc_t loc )

Definition at line 241 of file ast_new.c.

242 {
243 Exp* a = new_exp_unary_base(p, oper, loc);
244 exp_setmeta(a, 1);
245 a->d.exp_unary.code = code;
247 return a;
248}
StmtList * code
Definition absyn.h:531

◆ AST_NEW() [17/56]

ANEW ANN AST_NEW ( Exp * ,
prim_array ,
const Array_Sub exp,
const loc_t loc )

Definition at line 194 of file ast_new.c.

194 {
195 Exp* a = new_prim(p, loc);
197 a->d.prim.d.array = exp;
198 return a;
199}
union Exp_Primary::prim_data d
ae_prim_t prim_type
Definition absyn.h:475
Exp_Primary prim
Definition absyn.h:562

◆ AST_NEW() [18/56]

ANEW ANN AST_NEW ( Exp * ,
prim_char ,
const m_str chr,
const loc_t loc )

Definition at line 187 of file ast_new.c.

187 {
188 Exp* a = new_prim(p, loc);
190 a->d.prim.d.chr = chr;
191 return a;
192}

◆ AST_NEW() [19/56]

ANEW AST_NEW ( Exp * ,
prim_dict ,
Exp * exp,
const loc_t loc )

Definition at line 208 of file ast_new.c.

208 {
209 Exp* a = new_prim(p, loc);
211 a->d.prim.d.exp = exp;
212 return a;
213}

◆ AST_NEW() [20/56]

ANEW AST_NEW ( Exp * ,
prim_float ,
const m_float num,
const loc_t loc )

Definition at line 136 of file ast_new.c.

136 {
137 Exp* a = new_prim(p, loc);
139 a->d.prim.d.fnum = num;
140 return a;
141}

◆ AST_NEW() [21/56]

ANEW AST_NEW ( Exp * ,
prim_hack ,
Exp * exp,
const loc_t loc )

Definition at line 173 of file ast_new.c.

173 {
174 Exp* a = new_prim(p, loc);
176 a->d.prim.d.exp = exp;
177 return a;
178}

◆ AST_NEW() [22/56]

ANEW ANN AST_NEW ( Exp * ,
prim_id ,
struct Symbol_ * xid,
const loc_t loc )

Definition at line 157 of file ast_new.c.

157 {
158 Exp* a = new_prim(p, loc);
159 exp_setmeta(a, 0);
161 a->d.prim.d.var = xid;
162 return a;
163}
struct Symbol_ * var
Definition absyn.h:466

◆ AST_NEW() [23/56]

ANEW AST_NEW ( Exp * ,
prim_int ,
const m_uint i,
const loc_t loc )

Definition at line 129 of file ast_new.c.

129 {
130 Exp* a = new_prim(p, loc);
132 a->d.prim.d.gwint.num = i;
133 return a;
134}
m_int num
Definition absyn.h:452
struct gwint gwint
Definition absyn.h:467

◆ AST_NEW() [24/56]

ANEW ANN AST_NEW ( Exp * ,
prim_interp ,
Exp * exp,
const loc_t loc )

Definition at line 180 of file ast_new.c.

180 {
181 Exp* a = new_prim(p, loc);
183 a->d.prim.d.exp = exp;
184 return a;
185}

◆ AST_NEW() [25/56]

ANEW AST_NEW ( Exp * ,
prim_nil ,
const loc_t loc )

Definition at line 151 of file ast_new.c.

151 {
152 Exp* a = new_prim(p, loc);
154 return a;
155}

◆ AST_NEW() [26/56]

ANEW ANN AST_NEW ( Exp * ,
prim_range ,
Range * range,
const loc_t loc )

Definition at line 201 of file ast_new.c.

201 {
202 Exp* a = new_prim(p, loc);
204 a->d.prim.d.range = range;
205 return a;
206}

◆ AST_NEW() [27/56]

ANEW ANN AST_NEW ( Exp * ,
prim_string ,
const m_str s,
const uint16_t delim,
const loc_t loc )

Definition at line 143 of file ast_new.c.

143 {
144 Exp* a = new_prim(p, loc);
146 a->d.prim.d.string.data = s;
147 a->d.prim.d.string.delim = delim;
148 return a;
149}
uint16_t delim
Definition absyn.h:419
m_str data
Definition absyn.h:418
struct AstString string
Definition absyn.h:470

◆ AST_NEW() [28/56]

ANEW ANN AST_NEW ( Fptr_Def ,
fptr_def ,
Func_Base * base )

Definition at line 285 of file ast_new.c.

285 {
286 Fptr_Def a = mp_calloc(p, Fptr_Def);
287 a->base = base;
288 return a;
289}
Func_Base * base
Definition absyn.h:749

◆ AST_NEW() [29/56]

AST_NEW ( Func_Base * ,
func_base ,
Type_Decl * td,
const Symbol xid,
ArgList * args,
const ae_flag flag,
const loc_t loc )

Definition at line 275 of file ast_new.c.

276 {
277 Func_Base *a = (Func_Base *)mp_calloc(p, Func_Base);
278 a->td = td;
279 a->tag = MK_TAG(xid, loc);
280 a->args = args;
281 a->flag = flag;
282 return a;
283}
Tag tag
Definition absyn.h:731
ArgList * args
Definition absyn.h:732
Type_Decl * td
Definition absyn.h:730
ae_flag flag
Definition absyn.h:738

◆ AST_NEW() [30/56]

ANEW AST_NEW ( Func_Def ,
func_def ,
Func_Base * ,
StmtList *  )

◆ AST_NEW() [31/56]

AST_NEW ( Prim_Def ,
prim_def ,
const Symbol name,
const m_uint size,
const loc_t loc,
const ae_flag flag )

Definition at line 473 of file ast_new.c.

473 {
474 Prim_Def a = mp_calloc(p, Prim_Def);
475 a->tag = MK_TAG(name, loc);
476 a->size = size;
477 a->flag = flag;
478 return a;
479}
m_uint size
Definition absyn.h:806
Tag tag
Definition absyn.h:805
ae_flag flag
Definition absyn.h:807

◆ AST_NEW() [32/56]

AST_NEW ( Range * ,
range ,
Exp * start,
Exp * end )

Definition at line 17 of file ast_new.c.

17 {
18 Range *a = mp_calloc(p, Array_Sub);
19 a->start = start;
20 a->end = end;
21 return a;
22}
range.
Definition absyn.h:371
Exp * end
end of range expression
Definition absyn.h:373
Exp * start
start of range expression
Definition absyn.h:372

◆ AST_NEW() [33/56]

ANEW ANN AST_NEW ( Section * ,
section_class_def ,
const Class_Def  )

◆ AST_NEW() [34/56]

ANEW ANN AST_NEW ( Section * ,
section_enum_def ,
const Enum_Def  )

◆ AST_NEW() [35/56]

ANEW ANN AST_NEW ( Section * ,
section_extend_def ,
const Extend_Def  )

◆ AST_NEW() [36/56]

ANEW ANN AST_NEW ( Section * ,
section_fptr_def ,
const Fptr_Def  )

◆ AST_NEW() [37/56]

ANEW ANN AST_NEW ( Section * ,
section_func_def ,
const Func_Def  )

◆ AST_NEW() [38/56]

ANEW ANN AST_NEW ( Section * ,
section_stmt_list ,
StmtList *  )

◆ AST_NEW() [39/56]

ANEW ANN AST_NEW ( Section * ,
section_trait_def ,
const Trait_Def  )

◆ AST_NEW() [40/56]

ANEW ANN AST_NEW ( Section * ,
section_type_def ,
const Type_Def  )

◆ AST_NEW() [41/56]

ANEW ANN AST_NEW ( Section * ,
section_union_def ,
const Union_Def  )

◆ AST_NEW() [42/56]

ANEW AST_NEW ( Stmt * ,
stmt ,
const ae_stmt_t type,
const loc_t loc )

Definition at line 343 of file ast_new.c.

343 {
344 Stmt* a = mp_calloc2(p, sizeof(Stmt));
345 a->stmt_type = type;
346 a->loc = loc;
347 return a;
348}
loc_t loc
position
Definition absyn.h:205
ae_stmt_t stmt_type
Definition absyn.h:206

◆ AST_NEW() [43/56]

ANN ANEW AST_NEW ( Stmt * ,
stmt_code ,
StmtList * list,
const loc_t loc )

Definition at line 337 of file ast_new.c.

337 {
338 Stmt* a = new_stmt(p, ae_stmt_code, loc);
339 a->d.stmt_code.stmt_list = list;
340 return a;
341}
struct StmtList * stmt_list
Definition absyn.h:63
union Stmt::stmt_data d
struct Stmt_Code_ stmt_code
Definition absyn.h:190

◆ AST_NEW() [44/56]

ANEW ANN AST_NEW ( Stmt * ,
stmt_defer ,
Stmt * stmt,
const loc_t loc )

Definition at line 424 of file ast_new.c.

424 {
425 Stmt* a = new_stmt(p, ae_stmt_defer, loc);
426 a->d.stmt_defer.stmt = stmt;
427 return a;
428}
Stmt * stmt
Definition absyn.h:131
struct Stmt_Defer_ stmt_defer
Definition absyn.h:200

◆ AST_NEW() [45/56]

ANEW ANN AST_NEW ( Stmt * ,
stmt_each ,
struct Symbol_ * sym,
Exp * exp,
Stmt * body,
const loc_t loc )

Definition at line 369 of file ast_new.c.

370 {
371 Stmt* a = new_stmt(p, ae_stmt_each, loc);
372 a->d.stmt_each.var = (Var_Decl) { .tag = MK_TAG(sym, loc) };
373 a->d.stmt_each.exp = exp;
374 a->d.stmt_each.body = body;
375 return a;
376}
struct Var_Decl_ Var_Decl
Var_Decl var
Definition absyn.h:74
Exp * exp
Definition absyn.h:75
Stmt * body
Definition absyn.h:76
struct Stmt_Each_ stmt_each
Definition absyn.h:194

◆ AST_NEW() [46/56]

ANN ANEW AST_NEW ( Stmt * ,
stmt_exp ,
const ae_stmt_t type,
Exp * exp,
const loc_t loc )

Definition at line 330 of file ast_new.c.

331 {
332 Stmt* a = new_stmt(p, type, loc);
333 a->d.stmt_exp.val = exp;
334 return a;
335}
Exp * val
Definition absyn.h:40
struct Stmt_Exp_ stmt_exp
Definition absyn.h:189

◆ AST_NEW() [47/56]

ANEW ANN AST_NEW ( Stmt * ,
stmt_flow ,
const ae_stmt_t type,
Exp * cond,
Stmt * body,
const bool is_do,
const loc_t loc )

Definition at line 350 of file ast_new.c.

351 {
352 Stmt* a = new_stmt(p, type, loc);
353 a->d.stmt_flow.is_do = !!is_do;
354 a->d.stmt_flow.cond = cond;
355 a->d.stmt_flow.body = body;
356 return a;
357}
bool is_do
Definition absyn.h:50
Stmt * body
Definition absyn.h:49
Exp * cond
Definition absyn.h:48
struct Stmt_Flow_ stmt_flow
Definition absyn.h:191

◆ AST_NEW() [48/56]

ANEW AST_NEW ( Stmt * ,
stmt_for ,
Stmt * c1,
Stmt * c2,
Exp * c3,
Stmt * body,
const loc_t loc )

Definition at line 359 of file ast_new.c.

360 {
361 Stmt* a = new_stmt(p, ae_stmt_for, loc);
362 a->d.stmt_for.c1 = c1;
363 a->d.stmt_for.c2 = c2;
364 a->d.stmt_for.c3 = c3;
365 a->d.stmt_for.body = body;
366 return a;
367}
Stmt * body
Definition absyn.h:70
Stmt * c2
Definition absyn.h:68
Stmt * c1
Definition absyn.h:67
Exp * c3
Definition absyn.h:69
struct Stmt_For_ stmt_for
Definition absyn.h:193

◆ AST_NEW() [49/56]

ANN ANEW AST_NEW ( Stmt * ,
stmt_if ,
Exp * cond,
Stmt * if_body,
const loc_t loc )

Definition at line 393 of file ast_new.c.

394 {
395 Stmt* a = new_stmt(p, ae_stmt_if, loc);
396 a->d.stmt_if.cond = cond;
397 a->d.stmt_if.if_body = cpy_stmt3(p, if_body);
398 return a;
399}
ANN Stmt * cpy_stmt3(MemPool p, const Stmt *src)
Definition ast_cpy.c:440
Stmt * if_body
Definition absyn.h:89
Exp * cond
Definition absyn.h:88
struct Stmt_If_ stmt_if
Definition absyn.h:195

◆ AST_NEW() [50/56]

ANEW ANN AST_NEW ( Stmt * ,
stmt_loop ,
Exp * cond,
Stmt * body,
const loc_t loc )

Definition at line 378 of file ast_new.c.

379 {
380 Stmt* a = new_stmt(p, ae_stmt_loop, loc);
381 a->d.stmt_loop.cond = cond;
382 a->d.stmt_loop.body = body;
383 return a;
384}
Exp * cond
Definition absyn.h:82
Stmt * body
Definition absyn.h:83
struct Stmt_Loop_ stmt_loop
Definition absyn.h:192

◆ AST_NEW() [51/56]

ANEW ANN AST_NEW ( Stmt * ,
stmt_try ,
Stmt * stmt,
HandlerList * handler )

Definition at line 386 of file ast_new.c.

386 {
387 Stmt* a = new_stmt(p, ae_stmt_try, stmt->loc);
388 a->d.stmt_try.stmt = cpy_stmt3(p, stmt);
389 a->d.stmt_try.handler = handler;
390 return a;
391}
HandlerList * handler
Definition absyn.h:106
Stmt * stmt
Definition absyn.h:105
struct Stmt_Try_ stmt_try
Definition absyn.h:196

◆ AST_NEW() [52/56]

ANN ANEW AST_NEW ( Tmpl * ,
tmpl ,
SpecializedList * list )

Definition at line 262 of file ast_new.c.

262 {
263 Tmpl *a = mp_calloc(p, Tmpl);
264 a->list = list;
265 return a;
266}
Definition absyn.h:478
SpecializedList * list
Definition absyn.h:479

◆ AST_NEW() [53/56]

ANN ANEW AST_NEW ( Tmpl * ,
tmpl_call ,
TmplArgList * tl )

Definition at line 298 of file ast_new.c.

298 {
299 Tmpl *a = mp_calloc(p, Tmpl);
300 a->call = tl;
301 return a;
302}
TmplArgList * call
Definition absyn.h:480

◆ AST_NEW() [54/56]

ANEW ANN AST_NEW ( Type_Decl * ,
type_decl ,
const Symbol xid,
const loc_t loc )

Definition at line 4 of file ast_new.c.

4 {
5 Type_Decl *a = mp_calloc(p, Type_Decl);
6 a->tag = MK_TAG(xid, loc);
7 return a;
8}
Tag tag
Definition absyn.h:279

◆ AST_NEW() [55/56]

ANEW ANN AST_NEW ( Type_Def ,
type_def ,
Type_Decl * ext,
const Symbol xid,
const loc_t loc )

Definition at line 291 of file ast_new.c.

291 {
292 Type_Def a = mp_calloc(p, Type_Def);
293 a->ext = ext;
294 a->tag = MK_TAG(xid, loc);
295 return a;
296}
Tag tag
Definition absyn.h:759
Type_Decl * ext
Definition absyn.h:757

◆ AST_NEW() [56/56]

ANEW ANN AST_NEW ( Union_Def ,
union_def ,
VariableList * l,
const loc_t loc )

Definition at line 409 of file ast_new.c.

409 {
410 Union_Def a = mp_calloc(p, Union_Def);
411 a->l = l;
412 a->tag.loc = loc; // change ctor
413 return a;
414}
loc_t loc
Definition absyn.h:27
Tag tag
Definition absyn.h:770
VariableList * l
Definition absyn.h:769

◆ cflag()

static ANN int cflag ( const Class_Def c,
const enum cflag flag )
inlinestatic

Definition at line 887 of file absyn.h.

887 {
888 return (c->cflag & flag) == flag;
889}
enum cflag cflag
Definition absyn.h:883

◆ exp_access()

static ANN m_str exp_access ( const Exp * e)
inlinestatic

Definition at line 635 of file absyn.h.

635 {
636 if (exp_getmeta(e)) return (m_str) "non-mutable";
637 return !exp_getprot(e) ? NULL : (m_str) "protected";
638}
static ANN int exp_getprot(const Exp *e)
Definition absyn.h:613

◆ exp_count()

static uint32_t exp_count ( Exp * exp)
inlinestatic

Definition at line 687 of file absyn.h.

687 {
688 uint32_t n = 0;
689 while(exp) {
690 n++;
691 exp = exp->next;
692 }
693 return n;
694}
Type_Decl * next
Definition absyn.h:282

◆ exp_getmeta()

static ANN int exp_getmeta ( const Exp * e)
inlinestatic

Definition at line 624 of file absyn.h.

624 {
625 return (e->emit_var & (1 << exp_state_meta)) == (1 << exp_state_meta);
626}
int16_t emit_var
Definition absyn.h:583

◆ exp_getprot()

static ANN int exp_getprot ( const Exp * e)
inlinestatic

Definition at line 613 of file absyn.h.

613 {
614 return (e->emit_var & (1 << exp_state_prot)) == (1 << exp_state_prot);
615}

◆ exp_getuse()

static ANN int exp_getuse ( const Exp * e)
inlinestatic

Definition at line 591 of file absyn.h.

591 {
592 return (e->emit_var & (1 << exp_state_use)) == (1 << exp_state_use);
593}

◆ exp_getvar()

static ANN int exp_getvar ( const Exp * e)
inlinestatic

Definition at line 602 of file absyn.h.

602 {
603 return (e->emit_var & (1 << exp_state_addr)) == (1 << exp_state_addr);
604}

◆ exp_self()

static Exp * exp_self ( const void * data)
inlinestatic

Definition at line 640 of file absyn.h.

640 {
641 return container_of((char *)data, Exp, d);
642}

◆ exp_setmeta()

static ANN void exp_setmeta ( Exp * e,
const bool val )
inlinestatic

Definition at line 628 of file absyn.h.

628 {
629 if (val)
630 e->emit_var |= 1 << exp_state_meta;
631 else
632 e->emit_var &= ~(1 << exp_state_meta);
633}

◆ exp_setprot()

static ANN void exp_setprot ( Exp * e,
const bool val )
inlinestatic

Definition at line 617 of file absyn.h.

617 {
618 if (val)
619 e->emit_var |= 1 << exp_state_prot;
620 else
621 e->emit_var &= ~(1 << exp_state_prot);
622}

◆ exp_setuse()

static ANN void exp_setuse ( Exp * e,
const bool val )
inlinestatic

Definition at line 595 of file absyn.h.

595 {
596 if (val)
597 e->emit_var |= 1 << exp_state_use;
598 else
599 e->emit_var &= ~(1 << exp_state_use);
600}

◆ exp_setvar()

static ANN void exp_setvar ( Exp * e,
const bool val )
inlinestatic

Definition at line 606 of file absyn.h.

606 {
607 if (val)
608 e->emit_var |= 1 << exp_state_addr;
609 else
610 e->emit_var &= ~(1 << exp_state_addr);
611}

◆ free_arg_list()

ANN void free_arg_list ( MemPool p,
ArgList *  )

◆ free_array_sub()

Exp *ANN void free_array_sub ( MemPool p,
Array_Sub  )

◆ free_ast()

ANN void free_ast ( MemPool p,
Ast  )

◆ free_class_def()

ANN void free_class_def ( MemPool p,
Class_Def  )

◆ free_enum_def()

ANN void free_enum_def ( MemPool p,
Enum_Def  )

◆ free_exp()

ANN void free_exp ( MemPool p,
Exp *  )

◆ free_extend_def()

ANN void free_extend_def ( MemPool p,
Extend_Def  )

◆ free_fptr_def()

ANN void free_fptr_def ( MemPool p,
Fptr_Def  )

◆ free_func_base()

ANN void free_func_base ( MemPool p,
Func_Base *  )

◆ free_func_def()

ANN void free_func_def ( MemPool p,
Func_Def  )

◆ free_prim_def()

ANN void free_prim_def ( MemPool p,
Prim_Def  )

◆ free_specialized_list()

ANN void free_specialized_list ( MemPool p,
SpecializedList *  )

◆ free_stmt()

ANN void free_stmt ( MemPool p,
Stmt *  )

◆ free_stmt_list()

ANN void free_stmt_list ( MemPool ,
StmtList *  )

◆ free_tmpl()

ANN void free_tmpl ( MemPool p,
Tmpl *  )

◆ free_tmplarg_list()

ANN void free_tmplarg_list ( MemPool p,
TmplArgList *  )

◆ free_trait_def()

ANN void free_trait_def ( MemPool p,
Trait_Def  )

◆ free_type_decl()

ANN void free_type_decl ( MemPool p,
Type_Decl *  )

◆ free_type_def()

ANN void free_type_def ( MemPool p,
Type_Def  )

◆ free_union_def()

ANN void free_union_def ( MemPool p,
Union_Def  )

◆ free_variablelist()

ANN void free_variablelist ( MemPool p,
VariableList *  )

◆ is_prim()

static bool is_prim ( const Exp * e)
inlinestatic

Definition at line 813 of file absyn.h.

813{ return e->exp_type == ae_exp_primary; }
ae_exp_t exp_type
Definition absyn.h:582

◆ is_prim_float()

static bool is_prim_float ( const Exp * e)
inlinestatic

Definition at line 819 of file absyn.h.

819 {
820 return (is_prim(e) && e->d.prim.prim_type == ae_prim_float);
821}
static bool is_prim(const Exp *e)
Definition absyn.h:813

◆ is_prim_int()

static bool is_prim_int ( const Exp * e)
inlinestatic

Definition at line 815 of file absyn.h.

815 {
816 return (is_prim(e) && e->d.prim.prim_type == ae_prim_num);
817}

◆ is_spread_tmpl()

static ANN bool is_spread_tmpl ( const Tmpl * tmpl)
inlinestatic

Definition at line 486 of file absyn.h.

486 {
487 const Specialized spec = specializedlist_at(tmpl->list, tmpl->list->len - 1);
488 return !strcmp(s_name(spec.tag.sym), "...");
489}
Tag tag
Definition absyn.h:387
Symbol sym
Definition absyn.h:26

◆ MK_VECTOR_TYPE()

MK_VECTOR_TYPE ( Tag ,
tag  )

◆ new_class_def()

ANEW Class_Def new_class_def ( MemPool p,
const ae_flag ,
const Tag ,
Type_Decl * ,
const Ast  )

◆ new_extend_def()

ANEW Extend_Def new_extend_def ( MemPool p,
Type_Decl * const ,
TagList * const  )

◆ new_trait_def()

ANN ANEW Trait_Def new_trait_def ( MemPool p,
const ae_flag ,
const Symbol ,
const Ast ,
const loc_t  )

◆ prim_exp()

static Exp * prim_exp ( const void * data)
inlinestatic

Definition at line 646 of file absyn.h.

646 {
647 const Exp_Primary *p = prim_self(data);
648 return exp_self(p);
649}
static Exp_Primary * prim_self(const void *data)
Definition absyn.h:643
static Exp * exp_self(const void *data)
Definition absyn.h:640

◆ prim_pos()

static loc_t prim_pos ( const void * data)
inlinestatic

Definition at line 650 of file absyn.h.

650 {
651 const Exp* e = prim_exp(data);
652 return e->loc;
653}
static Exp * prim_exp(const void *data)
Definition absyn.h:646
loc_t loc
Definition absyn.h:581

◆ prim_self()

static Exp_Primary * prim_self ( const void * data)
inlinestatic

Definition at line 643 of file absyn.h.

643 {
644 return container_of((char *)data, Exp_Primary, d);
645}

◆ stmt_self()

static Stmt * stmt_self ( const void * data)
inlinestatic

Definition at line 218 of file absyn.h.

218 {
219 return container_of((char *)data, Stmt, d);
220}

◆ take_exp()

static Exp * take_exp ( Exp * exp,
const uint32_t n )
inlinestatic

Definition at line 697 of file absyn.h.

697 {
698 Exp* e = exp;
699 for (uint32_t i = 1; i < n; i++) CHECK_O((e = e->next));
700 return e;
701}
Exp * next
Definition absyn.h:578

◆ tmpl_base()

static bool tmpl_base ( const Tmpl * a)
inlinestatic

Definition at line 492 of file absyn.h.

492 {
493 if (a && !a->call) return true;
494 return false;
495}

◆ tmplarg_has_const()

static ANN uint32_t tmplarg_has_const ( const TmplArgList * tl)
inlinestatic

Definition at line 293 of file absyn.h.

293 {
294 for(uint32_t i = 0; i < tl->len; i++) {
295 const TmplArg ta = tmplarglist_at(tl, i);
296 if(ta.type == tmplarg_exp) return true;
297 }
298 return false;
299}
enum tmplarg_t type
Definition absyn.h:263

◆ tmplarg_ntypes()

static ANN uint32_t tmplarg_ntypes ( const TmplArgList * tl)
inlinestatic

Definition at line 301 of file absyn.h.

301 {
302 uint32_t ret = 0;
303 for(uint32_t i = 0; i < tl->len; i++) {
304 const TmplArg ta = tmplarglist_at(tl, i);
305 if(ta.type == tmplarg_td) ret++;
306 }
307 return ret;
308}

Variable Documentation

◆ __attribute__

typedef __attribute__

◆ exp

ANEW const Type_Decl Exp* exp

Definition at line 681 of file absyn.h.

◆ exp_lambda

exp_lambda

Definition at line 347 of file absyn.h.

◆ exp_unary2

ANEW exp_unary2

Definition at line 680 of file absyn.h.

◆ fbflag_default

fbflag_default = 1 << 7

Definition at line 6 of file absyn.h.

◆ fbflag_internal

fbflag_internal = 1 << 5

Definition at line 4 of file absyn.h.

◆ fbflag_lambda

fbflag_lambda = 1 << 6

Definition at line 5 of file absyn.h.

◆ fbflag_locale

fbflag_locale = 1 << 8

Definition at line 7 of file absyn.h.

◆ fbflag_none

fbflag_none = 1 << 0

Definition at line 0 of file absyn.h.

◆ fbflag_op

fbflag_op = 1 << 1

Definition at line 1 of file absyn.h.

◆ fbflag_postfix

fbflag_postfix = 1 << 4

Definition at line 3 of file absyn.h.

◆ fbflag_unary

fbflag_unary = 1 << 3

Definition at line 2 of file absyn.h.

◆ loc_t

ANEW const Type_Decl Exp const loc_t

Definition at line 236 of file absyn.h.

◆ prim_perform

ANEW prim_perform

Definition at line 656 of file absyn.h.

◆ stmt_pp

ANEW stmt_pp

Definition at line 235 of file absyn.h.

◆ Symbol

ANEW const Symbol

Definition at line 347 of file absyn.h.