51CTO博客开发
C- (Cminus) is a subset of C which I played around to set up my compiler. It supports arrays, function calls, if-else and loop statement. The major (or say the ONLY) data type supported is int.&n
This is a simple sample how Lex and Yacc cowork. 1) The agreement is Yacc gets tokens by calling a function called yylex(). We define Yacc's yylex() to be static who just calls Lex'
I use MIPS as the target language for my C- language. SPIM is a simulator for MIPS. A SPIM Program must include a label “main” – this will be called by the SPIM startup code (a
Longest Common String是两个字符串的最长公共子串。一个简洁的方法是用一个矩阵记录两个字符串中所有位置的两个字符之间的匹配情况,若是匹配则为1,否则为0。然后找出对角线方向上最长的1序列,其对应的位置就是最长匹配子串的位置。 例如求"123abc21"和"x23bc2"的LCS。 &nbs
Cache 第K级存储设备(快,小),存放第K+1级存储设备(慢,大)的部分内容。Cache管理的主要内容是对数据分块,在第K与K+1级设备之间传输数据,判定及处理cache miss/hit。 假设我的PC的内存是M(比如32MB),那它就有32M个唯一的地址,即m位(此例为25位)。典型的Cache会组织成S个set(比如32个,即s位selection index),每个set有E个ca
Reverse a linked list. static void Reverse(struct node** headRef) { struct node* target = NULL; &nb
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号