⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 util.c

📁 针对“虎书”中的tiger语言写的词法分析器 实现了多重注释嵌套、字符串中特殊转义字符和文件结束等处理。 具体请参考Readme.txt
💻 C
字号:
/* * util.c - commonly used utility functions. */#include <stdio.h>#include <stdlib.h>#include <string.h>#include "util.h"void *checked_malloc(int len){void *p = malloc(len); if (!p) {    fprintf(stderr,"\nRan out of memory!\n");    exit(1); } return p;}string String(char *s){string p = checked_malloc(strlen(s)+1); strcpy(p,s); return p;}U_boolList U_BoolList(bool head, U_boolList tail){ U_boolList list = checked_malloc(sizeof(*list));  list->head = head;  list->tail = tail;  return list;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -