Skip to content

Instantly share code, notes, and snippets.

@JeOam
Created August 10, 2016 13:25
Show Gist options
  • Save JeOam/2204c320051103cf82c4397169f73969 to your computer and use it in GitHub Desktop.
Save JeOam/2204c320051103cf82c4397169f73969 to your computer and use it in GitHub Desktop.
自制编程语言
@JeOam
Copy link
Author

JeOam commented Aug 14, 2016

  • 如果环境无法直接运行 yacc,可以使用 GNU 项目提供的 bison
  • 如果环境无法直接运行 lex,可以使用lex的免费版 flex

Instal flex and yacc on OS X:

brew install flex
brew install bison

编译 mycalc 项目:

$ bison --yacc -dv mycalc.y  #  生成 y.output y.tab.c  y.tab.h 文件
$ flex mycalc.l  # 生成 lex.yy.c 文件
$ cc -o mycalc y.tab.c lex.yy.c
$ ./mycalc
... 1+1
>>2.000000

@JeOam
Copy link
Author

JeOam commented Aug 28, 2016

Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment