mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-01-13 08:06:31 +00:00
Prs -> Parse
This commit is contained in:
parent
be599728c7
commit
36737c09e1
19 changed files with 334 additions and 335 deletions
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
U0 AsmPrsInsFlags(CCompCtrl *cc,CInst *tmpins)
|
||||
U0 AsmParseInsFlags(CCompCtrl *cc,CInst *tmpins)
|
||||
{
|
||||
I64 i;
|
||||
while (TRUE) {
|
||||
|
@ -117,7 +117,7 @@ U0 AsmHashLoad()
|
|||
else if (cc->token!=';')
|
||||
LexExcept(cc,"Expecting ',' at ");
|
||||
|
||||
AsmPrsInsFlags(cc,tmpins);
|
||||
AsmParseInsFlags(cc,tmpins);
|
||||
|
||||
tmpins->uasm_slash_val=tmpins->slash_val;
|
||||
if (tmpins->flags&IEF_STI_LIKE && tmpins->slash_val!=SV_I_REG)
|
||||
|
|
|
@ -32,10 +32,10 @@ extern U0 ParseStreamBlk(CCompCtrl *cc);
|
|||
extern CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
|
||||
I64 *_mode,CMemberList *tmpm,U8 **_ident,CHashFun **_fun_ptr,
|
||||
CHashExport **_tmpex,CArrayDim *tmpad,I64 fsp_flags);
|
||||
extern I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStack *ps,
|
||||
extern I64 ParseUnaryModifier(CCompCtrl *cc,CParseStack *ps,
|
||||
CMemberList **_local_var,CArrayDim **_tmpad,I64 *unary_post_prec);
|
||||
extern I64 ParseUnaryTerm(
|
||||
CCompCtrl *cc,CPrsStack *ps,CMemberList **_local_var,CArrayDim **_tmpad,
|
||||
CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var,CArrayDim **_tmpad,
|
||||
I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec);
|
||||
extern U0 ParseVarInit2(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
||||
CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass);
|
||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -58,7 +58,7 @@ CCompCtrl *CompCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
|
|||
U0 CompCtrlDel(CCompCtrl *cc)
|
||||
{//Free CCompCtrl.
|
||||
while (LexFilePop(cc));
|
||||
LinkedListDel(cc->lex_prs_stack);
|
||||
LinkedListDel(cc->lex_parse_stack);
|
||||
LinkedListDel(cc->htc.next);
|
||||
Free(cc->ps);
|
||||
Free(cc->cur_str);
|
||||
|
|
|
@ -16,14 +16,14 @@ U0 LexPush(CCompCtrl *cc)
|
|||
if (cc->lex_include_stack->last_U16)
|
||||
cc->flags|=CCF_USE_LAST_U16;
|
||||
tmpf=MAllocIdent(cc->lex_include_stack);
|
||||
tmpf->next=cc->lex_prs_stack;
|
||||
cc->lex_prs_stack=tmpf;
|
||||
tmpf->next=cc->lex_parse_stack;
|
||||
cc->lex_parse_stack=tmpf;
|
||||
}
|
||||
|
||||
U0 LexPopRestore(CCompCtrl *cc)
|
||||
{//Restore token-stream saved-point.
|
||||
//Bad things can happen if you cross an #include file boundary.
|
||||
CLexFile *tmpf=cc->lex_prs_stack;
|
||||
CLexFile *tmpf=cc->lex_parse_stack;
|
||||
cc->cur_buf_ptr=tmpf->buf_ptr;
|
||||
if (cc->last_U16=tmpf->last_U16)
|
||||
cc->flags|=CCF_USE_LAST_U16;
|
||||
|
@ -31,14 +31,14 @@ U0 LexPopRestore(CCompCtrl *cc)
|
|||
cc->flags&=~CCF_USE_LAST_U16;
|
||||
MemCopy(cc->lex_include_stack(U8 *)+sizeof(U8 *),tmpf(U8 *)+sizeof(U8 *),
|
||||
sizeof(CLexFile)-sizeof(U8 *));
|
||||
cc->lex_prs_stack=tmpf->next;
|
||||
cc->lex_parse_stack=tmpf->next;
|
||||
Free(tmpf);
|
||||
}
|
||||
|
||||
U0 LexPopNoRestore(CCompCtrl *cc)
|
||||
{//Don't restore token-stream saved-point.
|
||||
CLexFile *tmpf=cc->lex_prs_stack;
|
||||
cc->lex_prs_stack=tmpf->next;
|
||||
CLexFile *tmpf=cc->lex_parse_stack;
|
||||
cc->lex_parse_stack=tmpf->next;
|
||||
Free(tmpf);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ args.
|
|||
CIntermediateCode *tmpi,*tmpi1,*tmpi2,*tmpi3,*tmpi_push,
|
||||
*last_with_class=NULL;
|
||||
CCodeMisc *lb,*lb1,*lb2;
|
||||
CPrsStack *ps;
|
||||
CParseStack *ps;
|
||||
if (!(ps=cc->ps))
|
||||
ps=cc->ps=MAlloc(sizeof(CPrsStack));
|
||||
ps=cc->ps=MAlloc(sizeof(CParseStack));
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
tmpi=cc->coc.coc_head.next;
|
||||
|
@ -939,7 +939,7 @@ args.
|
|||
tmpi2 = OptLead1(tmpi);
|
||||
tmpi1->ic_flags |= tmpi->ic_flags | tmpi2->ic_flags;
|
||||
OptSetNOP1(tmpi2); //CALL_END
|
||||
OptSetNOP1(tmpi); //POPCNT
|
||||
OptSetNOP1(tmpi); //POPCNT
|
||||
}
|
||||
break;
|
||||
case IC_LBTS:
|
||||
|
|
|
@ -9,7 +9,7 @@ U0 OptPass3(CCompCtrl *cc,COptReg *reg_offsets)
|
|||
COptMemberVar *mv=NULL;
|
||||
CAOT *tmpaot;
|
||||
CAOTImportExport *tmpie;
|
||||
CPrsStack *ps=cc->ps;
|
||||
CParseStack *ps=cc->ps;
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ U0 OptPass4(CCompCtrl *cc,COptReg *reg_offsets,I64 *_type)
|
|||
I64 code,i;
|
||||
Bool dead_code=FALSE;
|
||||
CCodeMisc *lb;
|
||||
CPrsStack *ps=cc->ps;
|
||||
CParseStack *ps=cc->ps;
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ U0 OptPass5(CCompCtrl *cc)
|
|||
{
|
||||
CIntermediateCode *tmpi,*tmpi1;
|
||||
I64 code,i;
|
||||
CPrsStack *ps=cc->ps;
|
||||
CParseStack *ps=cc->ps;
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Bool OptIC6(CIntermediateCode *tmpi)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
U0 OptPass6Lag(CCompCtrl *cc,CPrsStack *ps,CIntermediateCode *tmpi,
|
||||
U0 OptPass6Lag(CCompCtrl *cc,CParseStack *ps,CIntermediateCode *tmpi,
|
||||
I64 *_stack_ptr,I64 reg_stack_size,I64 *_clobbered_reg_mask)
|
||||
{
|
||||
I64 stack_ptr=*_stack_ptr,code,
|
||||
|
@ -97,7 +97,7 @@ U0 OptPass6(CCompCtrl *cc)
|
|||
{
|
||||
CIntermediateCode *tmpi,*tmpi_next,*tmpil1,*tmpil2,*old_tmpil2;
|
||||
I64 stack_ptr=0,reg_stack_size,clobbered_reg_mask=REGG_CLOBBERED;
|
||||
CPrsStack *ps=cc->ps;
|
||||
CParseStack *ps=cc->ps;
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
if (Bt(&cc->opts,OPTf_NO_REG_VAR) || cc->flags&CCF_NO_REG_OPT)
|
||||
|
|
|
@ -62,7 +62,7 @@ CIntermediateCode *ParseAddOp(CCompCtrl *cc,I64 stack_op,CHashClass *tmpc)
|
|||
return tmpi;
|
||||
}
|
||||
|
||||
U0 ParseExpression2(CCompCtrl *cc,I64 *_max_prec,CPrsStack *ps)
|
||||
U0 ParseExpression2(CCompCtrl *cc,I64 *_max_prec,CParseStack *ps)
|
||||
{
|
||||
I64 i,cur_op,stack_op,state,max_prec=PREC_NULL,unary_pre_prec,paren_prec,
|
||||
unary_post_prec,left_prec=PREC_MAX;
|
||||
|
@ -261,15 +261,15 @@ pe_done:
|
|||
*_max_prec=max_prec;
|
||||
}
|
||||
|
||||
Bool ParseExpression(CCompCtrl *cc,I64 *_max_prec,Bool end_exp,CPrsStack *_ps=NULL)
|
||||
Bool ParseExpression(CCompCtrl *cc,I64 *_max_prec,Bool end_exp,CParseStack *_ps=NULL)
|
||||
{
|
||||
Bool res=TRUE;
|
||||
I64 old_flags=cc->flags;
|
||||
CPrsStack *ps;
|
||||
CParseStack *ps;
|
||||
if (_ps)
|
||||
ps=_ps;
|
||||
else {
|
||||
ps=MAlloc(sizeof(CPrsStack));
|
||||
ps=MAlloc(sizeof(CParseStack));
|
||||
ps->ptr=0;
|
||||
ps->ptr2=0;
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ U0 ParseOffsetOf(CCompCtrl *cc)
|
|||
ICAdd(cc,IC_IMM_I64,i,cmp.internal_types[RT_I64]);
|
||||
}
|
||||
|
||||
I64 ParseFunCall(CCompCtrl *cc,CPrsStack *ps,Bool indirect,CHashFun *tmpf)
|
||||
I64 ParseFunCall(CCompCtrl *cc,CParseStack *ps,Bool indirect,CHashFun *tmpf)
|
||||
{
|
||||
I64 i,argc_count,default_val;
|
||||
Bool is_first_arg=TRUE,needs_right_paren,is_print,is_putchars,
|
||||
|
@ -590,7 +590,7 @@ I64 ParseFunCall(CCompCtrl *cc,CPrsStack *ps,Bool indirect,CHashFun *tmpf)
|
|||
return PE_UNARY_MODIFIERS;
|
||||
}
|
||||
|
||||
I64 ParseUnaryTerm(CCompCtrl *cc,CPrsStack *ps,CMemberList **_local_var,
|
||||
I64 ParseUnaryTerm(CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var,
|
||||
CArrayDim **_tmpad,I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec)
|
||||
{
|
||||
I64 i,j;
|
||||
|
@ -957,7 +957,7 @@ pu_export_sys_sym:
|
|||
LexExcept(cc,"Missing expression at ");
|
||||
}
|
||||
|
||||
I64 ParseUnaryModifier(CCompCtrl *cc,CPrsStack *ps,CMemberList **_local_var,
|
||||
I64 ParseUnaryModifier(CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var,
|
||||
CArrayDim **_tmpad,I64 *unary_post_prec)
|
||||
{
|
||||
CHashClass *tmpc,*tmpc1;
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
U0 ParsePush(CPrsStack *ps,I64 val)
|
||||
U0 ParsePush(CParseStack *ps,I64 val)
|
||||
{
|
||||
ps->stack[++ps->ptr]=val;
|
||||
}
|
||||
|
||||
I64 ParsePop(CPrsStack *ps)
|
||||
I64 ParsePop(CParseStack *ps)
|
||||
{
|
||||
return ps->stack[ps->ptr--];
|
||||
}
|
||||
|
||||
U0 ParsePush2(CPrsStack *ps,I64 val)
|
||||
U0 ParsePush2(CParseStack *ps,I64 val)
|
||||
{
|
||||
ps->stack2[++ps->ptr2]=val;
|
||||
}
|
||||
|
||||
I64 ParsePop2(CPrsStack *ps)
|
||||
I64 ParsePop2(CParseStack *ps)
|
||||
{
|
||||
return ps->stack2[ps->ptr2--];
|
||||
}
|
||||
|
||||
U0 ParsePopDeref(CPrsStack *ps)
|
||||
U0 ParsePopDeref(CParseStack *ps)
|
||||
{
|
||||
I64 i=ParsePop(ps);
|
||||
CHashClass *tmpc=ParsePop(ps);
|
||||
|
|
|
@ -1175,13 +1175,13 @@ sm_not_keyword_afterall:
|
|||
LexExcept(cc,"Use Asm Blk at ");
|
||||
if (cc->token!=',') goto sm_done;
|
||||
} else
|
||||
goto sm_prs_exp;
|
||||
goto sm_parse_exp;
|
||||
}
|
||||
fsp_flags&=FSF_ASM;
|
||||
}
|
||||
} else {//Ident, not in hash table
|
||||
if (cc->local_var_entry)
|
||||
goto sm_prs_exp;
|
||||
goto sm_parse_exp;
|
||||
if (!(g_lb=COCGoToLabelFind(cc,cc->cur_str))) {
|
||||
g_lb=COCMiscNew(cc,CMT_GOTO_LABEL);
|
||||
g_lb->str=cc->cur_str;
|
||||
|
@ -1202,7 +1202,7 @@ sm_not_keyword_afterall:
|
|||
ParseFunCall(cc,NULL,FALSE,NULL);
|
||||
goto sm_semicolon;
|
||||
} else if (cc->token!=TK_EOF) {//Non-cur_str symbol, num or something
|
||||
sm_prs_exp:
|
||||
sm_parse_exp:
|
||||
if (!ParseExpression(cc,NULL,TRUE))
|
||||
throw('Compiler');
|
||||
sm_semicolon:
|
||||
|
|
BIN
src/Kernel.BIN.C
BIN
src/Kernel.BIN.C
Binary file not shown.
|
@ -1068,7 +1068,6 @@ $LK,"GVF_IMPORT",A="FL:::/Kernel/KernelA.HH,916"$
|
|||
$LK,"HTF_IMPORT",A="FL:::/Kernel/KernelA.HH,753"$
|
||||
$LK,"HTf_IMPORT",A="FL:::/Kernel/KernelA.HH,723"$
|
||||
$LK,"IEF_PLUS_OPCODE",A="FL:::/Kernel/KernelA.HH,1786"$
|
||||
$LK,"CPrsStack",A="FL:::/Kernel/KernelA.HH,1736"$
|
||||
$LK,"LAPIC_ICR_LOW",A="FL:::/Kernel/KernelA.HH,564"$
|
||||
$LK,"mouse",A="FL:::/Kernel/KGlobals.CC,24"$
|
||||
$LK,"D3Zero",A="FL:::/Kernel/KernelB.HH,148"$
|
||||
|
@ -2133,6 +2132,7 @@ $LK,"inf",A="FL:::/Kernel/KernelA.HH,49"$
|
|||
$LK,"sys_macro_head",A="FL:::/Kernel/KGlobals.CC,4"$
|
||||
$LK,"XTalk",A="FL:::/Kernel/Job.CC,445",BI=461$
|
||||
$LK,"SYS_ENTER_LONG_MODE",A="FL:::/Kernel/KStart64.CC,54"$
|
||||
$LK,"CParseStack",A="FL:::/Kernel/KernelA.HH,1736"$
|
||||
$LK,"eps",A="FL:::/Kernel/KernelA.HH,59"$
|
||||
$LK,"RLF_PATCHED",A="FL:::/Kernel/KernelA.HH,496"$
|
||||
$LK,"TaskDerivedValsUpdate",A="FL:::/Kernel/KTask.CC,286",BI=462$
|
||||
|
|
|
@ -1733,7 +1733,7 @@ class CIntermediateCode:CIntermediateCodeBase
|
|||
#assert !($$&7)
|
||||
};
|
||||
|
||||
class CPrsStack
|
||||
class CParseStack
|
||||
{
|
||||
I64 ptr,
|
||||
stack[255],
|
||||
|
@ -2248,7 +2248,7 @@ public class CCompCtrl
|
|||
CCodeMisc *lb_leave;
|
||||
U8 *cur_buf_ptr;
|
||||
CLexFile *lex_include_stack,
|
||||
*lex_prs_stack,
|
||||
*lex_parse_stack,
|
||||
*fun_lex_file;
|
||||
CStreamBlk *next_stream_blk,*last_stream_blk;
|
||||
CAOT *aot;
|
||||
|
@ -2263,7 +2263,7 @@ public class CCompCtrl
|
|||
dont_push_float,pad[4];
|
||||
|
||||
CCodeCtrl coc;
|
||||
CPrsStack *ps;
|
||||
CParseStack *ps;
|
||||
CAOTCtrl *aotc;
|
||||
I64 aot_depth,prompt_line;
|
||||
#assert !($$&7)
|
||||
|
@ -3994,4 +3994,3 @@ class CProgress
|
|||
#define PRINTF_NEG_E 0x400
|
||||
#define PRINTF_NEG_AUX_FORMAT_NUM 0x800
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in a new issue