Created
February 3, 2012 13:41
-
-
Save suin/1730216 to your computer and use it in GitHub Desktop.
kmyaccとPHPでオレオレプログラミング言語を作る - 環境構築編 ref: http://qiita.com/items/2011
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git clone https://github.com/moriyoshi/kmyacc-forked.git | |
Cloning into kmyacc-forked... | |
remote: Counting objects: 76, done. | |
remote: Compressing objects: 100% (60/60), done. | |
remote: Total 76 (delta 14), reused 76 (delta 14) | |
Unpacking objects: 100% (76/76), done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd kmyacc-forked/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ /usr/bin/php sample/calc.php | |
1+2+3 | |
6 | |
^C |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vim src/Makefile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX = /usr/local を | |
PREFIX = /Users/suin に書き換える |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir ~/bin ~/lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo $PATH | |
/Users/suin/bin:/Applications/MAMP/bin/php5.2/bin:/Applications/MAMP/Library/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ make | |
cd src; make all | |
cc -Wall -O2 '-DPARSERBASE="/Users/suin/lib/kmyacc"' -c -o yacc.o yacc.c | |
cc -Wall -O2 '-DPARSERBASE="/Users/suin/lib/kmyacc"' -c -o grammar.o grammar.c | |
grammar.c: In function ‘intern’: | |
grammar.c:106: warning: cast from pointer to integer of different size | |
cc -Wall -O2 '-DPARSERBASE="/Users/suin/lib/kmyacc"' -c -o token.o token.c | |
token.c: In function ‘raw_gettoken’: | |
token.c:331: warning: control reaches end of non-void function | |
cc -Wall -O2 '-DPARSERBASE="/Users/suin/lib/kmyacc"' -c -o lalr.o lalr.c | |
lalr.c: In function ‘cmpprec’: | |
lalr.c:707: warning: control reaches end of non-void function | |
lalr.c: In function ‘item2pnum’: | |
lalr.c:170: warning: control reaches end of non-void function | |
cc -Wall -O2 '-DPARSERBASE="/Users/suin/lib/kmyacc"' -c -o misc.o misc.c | |
cc -Wall -O2 '-DPARSERBASE="/Users/suin/lib/kmyacc"' -c -o genparser.o genparser.c | |
cc -Wall -O2 '-DPARSERBASE="/Users/suin/lib/kmyacc"' -c -o compress.o compress.c | |
cc -Wall -O2 '-DPARSERBASE="/Users/suin/lib/kmyacc"' yacc.o grammar.o token.o lalr.o misc.o genparser.o compress.o -o kmyacc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ make install | |
cd src; make install | |
install -d /Users/suin/bin | |
install -s kmyacc /Users/suin/bin | |
install -d /Users/suin/lib | |
install -d /Users/suin/lib/kmyacc | |
install kmyacc.c.parser /Users/suin/lib/kmyacc | |
install kmyacc.java.parser /Users/suin/lib/kmyacc | |
install kmyacc.js.parser /Users/suin/lib/kmyacc | |
install kmyacc.pl.parser /Users/suin/lib/kmyacc | |
install kmyacc.py.parser /Users/suin/lib/kmyacc | |
install kmyacc.php.parser /Users/suin/lib/kmyacc | |
install kmyacc.as.parser /Users/suin/lib/kmyacc | |
install kmyacc.hsp.parser /Users/suin/lib/kmyacc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kmyacc | |
KMyacc - parser generator ver 4.1.4 | |
Copyright (C) 1987-1989,1992-1993,2005,2006 MORI Koichiro | |
Usage: kmyacc [-dvltani] [-b y] [-p yy] [-m model] [-L lang] grammar.y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kmyacc -m ~/lib/kmyacc/kmyacc.php.parser sample/calc.phpy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment