コード例 #1
0
ファイル: grammer.cpp プロジェクト: bingone/my_compiler
/**
声明符
<declarator>::={<TK_STAR>}[<function_calling_convention>] [<struct_member_alignment>]<direct_declarator>
*/
void declarator(){
    int fc;
    while(TK_STAR == token)
        get_token();
    function_calling_convention(&fc);
    struct_member_alignment();
    direct_declarator();
}
コード例 #2
0
ファイル: declaration.c プロジェクト: JamesLinus/c-compiler
struct typetree *declarator(struct typetree *base, const char **symbol)
{
    while (peek().token == '*') {
        base = pointer(base);
    }

    return direct_declarator(base, symbol);
}
コード例 #3
0
ファイル: parser.c プロジェクト: mdiaztello/zcc
TOKEN declarator(SYMBOL s)
{
    TOKEN ptr = NULL;
    TOKEN direct_dec = NULL;
    ptr = pointer();
    direct_dec = direct_declarator(s);

    return direct_dec;
}
コード例 #4
0
int declarator(char* result)
{
    char tmp[MAXTOKEN] = "";
    char token[MAXTOKEN];

    for (int type = gettoken(token); type == '*'; type = gettoken(token)) {
        type = gettoken(token);
        if (type == CONST) {
            strcat(tmp, " const pointer to");
        } else {
            strcat(tmp, " pointer to");
            unget_token();
        }
    }

    unget_token();
    int ret = direct_declarator(result);
    strcat(result, tmp);
    return ret;
}
コード例 #5
0
ファイル: parser.c プロジェクト: palmerc/lab
int direct_declarator(void) {
	if( lookaheadT.type == ID ) {
		match(ID);
	} else if( lookaheadT.type == LPAREN ) {
		match(LPAREN);
		declarator();
		match(RPAREN);
	} else if( direct_declarator() ) {
		if( lookaheadT.type == LBRACKET ) {
			match(LBRACKET);
			if( constant_expression() ) {
			}
			match(RBRACKET);
		} else if( lookaheadT.type == LPAREN ) {
			match(LPAREN);
			if( parameter_type_list() ) {
			} else if ( identifier_list() ) {
			}
			match(RPAREN);
		}
	}
}
コード例 #6
0
ファイル: parser.c プロジェクト: palmerc/lab
int declarator(void) {
	if( pointer() ) {
	}
	direct_declarator();
}