[[Programing]] > part2.yaccˤWebץȸ

[[Part1.>making_script01]]JavascriptǤΤǡϴñʥץȸäƤߤޤץȸγȯɬפʴŪʵѤǧ뤿ˡΤñʥץȸޤ

ΥڡǤϡkmyaccġȤơJavascriptưΤޤʸڤʤɤϺʤǡ̤Υץߥ󥰸Ѵޤ

''ȤꤢSaruMane Script(ץ)Ȥ̾դ뤳Ȥˤޤ''


#contents

*ʡ [#rd75ede8]

ץȸǤϡȰäơʸ䥳Ȥʤɤ򰷤Τǡޤʡ()ľޤ
ʸϤΩäơɤʸڤФʬԤΤΥʡϤȤ쥭륢ʥ饤(Lexical analyzer)ȸƤФޤ

ǤϡyaccΥץեˡʡΥɤޤƤޤ򺹤ؤޤ

ȤꤢǤϡʡư륵ץڡѰդޤ

-[[ץڡ:http://www.catch.jp/program/yacc/scanner.html]]

ʸȽ̤ˤϡɽȤäƤޤ

ѥʡyaccμ˹碌ơХѿ(!)ȤäƤޤ


*ʡư [#lc6dc3d4]

ʤϡɤ򼡤Τ褦ʬषƹʸϤޤ

-IDENT
--:̻(ѿ̾ؿ̾)
--§:ǽʸʸ(a-zA-Z)˥С(_)θ˱ѿ
-NUMBER
--:
--§:Ȥ롣
-STRING
--:ʸ
--§:֥륯ơ(")󥰥륯ơ(')ǰϤ
-COMMENT
--:Υ()
--§://
-
--׻䥫åʤ

Τ褦Ϥ

 123abc"xyz"//comment

Τ褦ɽޤ

 -1 : 123abc"xyz"//comment,token : 123,yylex : 257
 -1 : abc"xyz"//comment,token : abc,yylex : 258
 -1 : "xyz"//comment,token : xyz,yylex : 259
 -1 : //comment,token : //comment,yylex : COMMENT1

Ƭϲ԰(Ե椬ʤϡ-1)Τȡ߲ϤƤʸڤФ̡ʬ̤³ޤ

ʤʸȽ̤Ǥ褦ˤƤޤ̾ʸ̵뤷ƼΤƤ뤱ɡδʰץץȸѴʤΤǻĤ褦ˤƤޤ

*ʡȥѡȤ߹碌 [#z492ef3b]

ưǧΤᡢʡʬष̤̤褦ʹʸϴ(parser:ѡ)äƤߤޤ

 program:	/* empty */
        | program stmt { setAnswer(outputs); }
        ;
 
 stmt	: NUMBER  { outputs += "NUMBER: " + yylval + "<br>";}
 	| IDENT { outputs += "IDENT: " + yylval + "<br>";}
 	| STRING { outputs += "STRING: " + yylval + "<br>";}
 	| COMMENT { outputs += "COMMENT: " + yylval + "<br>";}
 	| '\n' { outputs += "(CR)<br>"; }
 	| error { $$ = ""; }
 	;

-[[ץڡ:http://www.catch.jp/program/yacc/script25.html]]

ʡʬष̤ϡʸ¦ȽǤơʬȥǡɽޤ

Ȥ

 123abc"xyz"//456

Ϥȡ

 NUMBER: 123
 IDENT: abc
 STRING: xyz
 COMMENT: //456

ɽޤ

-[[yaccե:http://www.catch.jp/program/yacc/script25.jsy]]


*ץäݤΤ񤱤褦ˤ [#be1bdb55]

ϡѡĥơʸȴؿȰ񤱤褦ˤޤ
ǡץäݤΤҤǤ褦ˤʤޤ


-[[ץڡ:http://www.catch.jp/program/yacc/script42.html]]

ȤСΤ褦Ϥ

 a=200
 x()
 y(100)
 z(1,2,3,4)
 a=1*(2+3)
 b=x(100)
 c=200 //comment

Τ褦ˡΤޤɽޤ

 a=200
 x()
 y(100)
 z(1,2,3,4)
 a=1*(2+3)
 b=x(100)
 c=200
 //comment

Ϥץ򡢤ä󥹥ʡǥХХˤơѡȤΩƤʤƤΤǤ

ޤǤʳбƤΤϡιʸǤ

-ؿƤӽФ funcall
--ؿ̾()//
--ؿ̾()//ʤ
-ʸ assign
--ѿ̾=
-ʸ //פޤ

- args
--1, 23
--1
- expr
--­, , ݤ, 껻, ;
--åˤͥդ, ؿƤӽФ

-ܥǡ¤ primary
--̻(ѿ̾, ؿ̾)
--
--ʸ󡡡֡ɡɡפ' 'פǰϤΡ׵Ȥʤ


ʸ롼˹פʤϡsyntax errorפɽޤ

ȤСΤ褦ˡʸ񤤤Ƥ⡢ؿƤӽФǤʸǤ⥳ʸǤʤᡢsyntax errorפɽޤ

 abc

ޤǤΡեϼΤ褦ˤʤäƤޤ

-[[yaccե:http://www.catch.jp/program/yacc/script42.jsy]]


*Processing.jsäݤ񤱤褦ˤ [#m9f7c70a]

ǺäƤʰץץȸϡåȸ[[Processing.js>Processing.jsú®]]ˤƤޤProcessing.jsϡӥ奢ǥѥץߥ󥰸Processing(ץå󥰡ˤWebǤǤ(Javascript١Processing)եå˥᡼桼ˤ갷䤹ʤäƤޤ

Processing.jsˤ롢˥᡼󥵥ץϤʴǤ

ץ  [[mouse_move:http://www.catch.jp/program/processing.js/mouse_move/]]


ʰץץȸμʵǽϡΤ褦ʴˤޤ

-̿ؿʤɤProcessing.jsȤʤ
-Υߥ(;)ס
-IfʸȤForʸȤWhileʸȤ⡢(Ȥꤢ)ʤProcessing.jsȡʤǤ⤽餷ץबΤǡ
-饹Ϥ뤱ɡ饹(ΤȤ)ʤ

ǡʤդΥߥʤΥץѴ


 void setup() {
   size(250, 250)
   frameRate(20)
 }
 void draw() {
   background(0)
   ellipse(width/2, height/2, mouseX, mouseY)
 }

ʤդˡProcessinng.jsѴޤ

 void setup() { size(250, 250);
   frameRate(20);
 }
 void draw() { background(0);
   ellipse(width/2, height/2, mouseX, mouseY);
 }

ץڡȥեϼΤ褦ˤʤäƤޤ

-[[ץڡ:http://www.catch.jp/program/yacc/script55.html]]
-[[yaccե:http://www.catch.jp/program/yacc/script55.jsy]]

ǤϡǽŪˤ̤줷ȤϤޤ󤬡ȼʸˡΥץȸκȤˤʤϤ


*Processing.jsѴƼ¹Ԥ [#c9c417c4]

ĤˡǤޤ

ѴɤProcessing.jsϤƼ¹Ԥޤ

ȤꤢץڡRunܥ򥯥å줫顢¦ιꥢ˥ޥݥ󥿤碌ȡΰ֤˹碌ʱߤޤΤˤϡѴΥץȤɽޤ

-[[ץڡ:http://www.catch.jp/program/yacc/SaruMane/SaruMane_Script.html]]
-[[yaccե:http://www.catch.jp/program/yacc/SaruMane/sarumane_script.jsy]]


*ư [#y06871df]

˴ʰŪʥץȸʤΤǡΤ褦դɬפǤ

**֥åȤб [#i0d46da3]

/* */פȤäʣԤˤޤ륳ȤϡΤȤȤޤ

**ǥХåġˤǥХå [#v3fdce02]

ץȤϡѴľܼ¹ԤƤΤǡǥХåġŬѤǤޤ

ѴΥץȤProcessing.jsľŽդȤ⤦䤹ʤ뤫⡣

**ХѿξͲ [#u96ec2c5]

SaruMane ScriptϡĤХѿȤäƤޤ(yyyBufferyyyTokenyylval)̤̾ˤƤΤǡͤ뤳ȤϡۤȤɤʤȻפޤǰΤդƤ

ХѿȤäƤȡ¾ΥץȾͤΤǡJavascriptξѴץ򥯥㡼ˤȤкʤʤʤʡȻפäƤɡĴ٤Ƥߤ顢äȼ֤Τǡ󤷤ˤޤ


----

[[Part1.yaccˤJavascript>making_script01]]

[[Part3.ܸäݤWebץȸ>making_script03]]˿ʤ

* [#qed12373]

-[[ycatch/SaruMane.js - GitHub:https://github.com/ycatch/SaruMane.js]]

*ͻ [#l1457785]

-[[ȬѸ : Series: Flash/Flex Ǻ벶͸(kmyacc) &#171;:http://www.hakkaku.net/series/flashflex%e3%81%a7%e4%bd%9c%e3%82%8b%e4%bf%ba%e6%a7%98%e8%a8%80%e8%aa%9ekmyacc%e7%b7%a8]]
--[[Flash/FlexǺ벶͸(kmyacc)1- kmyacc  ActionScript ǤȤäƤߤ褦:http://www.hakkaku.net/articles/20080226-154]]
--[[Flash/FlexǺ벶͸(kmyacc)2- kmyacc  BASICäݤäƤߤ褦:http://www.hakkaku.net/articles/20080307-158#more-158]]
--[[Shibuya.abcꡢäͷ٤벶͸äƤ(1):http://www.hakkaku.net/articles/20080317-170]]

-[[RubyǺ̯ʥץߥ󥰸~Esoteric Language~:http://www.amazon.co.jp/gp/product/4839927847?ie=UTF8&tag=plaseboeffect-22&linkCode=as2&camp=247&creative=7399&creativeASIN=4839927847]] Amazon
--ʤϡ+-><.,[]פ8Ĥε椷ʤץߥ󥰸䡢ǹץߥ󥰸줬Τ¸ܽǤϡʴ̯ʸ(Esoteric Language)˥ץߥ󥰸κ⤷ޤ
-[[Ruby256ܻȤ_̵ƻ:http://www.amazon.co.jp/gp/product/4756137091?ie=UTF8&tag=plaseboeffect-22&linkCode=as2&camp=247&creative=7399&creativeASIN=4756137091]] Amazon
--Ruby+Raccʤ顢ץߥ󥰸쳫ȯäƳڤʤ!ѡͥ졼Ȥɤʥͥ256ή˴⡣줵Сߤ⺣쳫ȯԤ!
-ޤĤľץߥ󥰤Υ 6 ᥿ץߥ
--http://itpro.nikkeibp.co.jp/article/COLUMN/20070604/273453/
--ޤȤƤߤȡRubyDSLʸʬޤ
-Racc ͷܤ
--Racc򤤤塼ȥꥢ
--http://www.mnet.ne.jp/~tnomura/racc.html

-ˤRubyƻ5 Rubyǽ񤯥եȥɤȥѡ
--http://www.notwork.org/~gotoken/mag/cmagazine/gokudo/5th/

-[[ץߥ󥰸:http://kmaebashi.com/programmer/devlang/index.html]]
-[[Υ by Zynga Japan: 1֤Ǻʰץץȸ(JavaScript):http://labs.unoh.net/2007/03/1javascript.html]]

-[[JavaScript]]
-[[ParserGenerator - catch.jp:http://www.catch.jp/wiki/index.php?ParserGenerator]]
-[[JavaScript - 100Ԥǽ񤯲ͥץߥ󥰸쥳ѥAltJS - Qiita:http://qiita.com/KDKTN/items/a151d8d003a62c7b2ca3]]

ȥå   ʬ Хåå   ñ측 ǽ   إ   ǽRSS