Marpa :: PP. ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À̸§:
- Jeffrey Kegler
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~jkegl/
Marpa :: PP. ű×
Marpa :: PP. ¼³¸í
MarpaÀÇ ¼ø¼öÇÑ ÆÞ ¹öÀü Marpa :: PP´Â ¹®¹ýÀ» BNF·Î ÀÛ¼ºÇÒ ¼öÀÖ´Â ¾ð¾î¸¦ ±¸¹® ºÐ¼®ÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. Àç±Í ¹®¹ý, ¸ðÈ£ÇÑ ¹®¹ý, ¹«ÇÑÈ÷ ¸ðÈ£ÇÑ ¹®¹ý ¹× ¾µ¸ð¾ø´Â ¶Ç´Â ºó ÇÁ·Î´ö¼ÇÀ» Æ÷ÇÔÇÏ´Â ¹®¼°¡ Æ÷ÇԵ˴ϴÙ.ÀÌ ¹®¼¿¡´Â Marpa Parse EngineÀÇ APIÀÇ ÃÖ»óÀ§ °³¿ä°¡ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù. ÀÌ ¹®¼ÀÇ µÎ ¿¹Á¦´Â Marpa ¸Þ¼µå È£ÃâÀÇ ÀϹÝÀûÀÎ È帧À» º¸¿©ÁÝ´Ï´Ù. ÀÌ ¹®¼´Â Semi-Tutorial Fashion¿¡¼ MarpaÀÇ ±âº» ±â´ÉÀ» ¼³¸íÇϱâ À§ÇØÀÌ ¿¹Á¦¸¦ »ç¿ëÇÕ´Ï´Ù. MarpaÀÇ °í±Þ ±â´É ¹× ¸ðµç ±â´ÉÀÇ Àüü ÂüÁ¶ ¼¼ºÎ Á¤º¸´Â ´Ù¸¥ Marpa API Documents.Synopsis »ç¿ë Marpa :: PP; MY $ grammar = marpa :: grammar-> new ({start => expression ', actions => my_actions', default_action => 'first_arg', rules => }, {LHS => '¿ë¾î', RHS => }, {LHS => ÆÑÅÍ ', RHS => }, {LHS =>' ¿ë¾î ', RHS => , µ¿ÀÛ =>'ÆÑÅÍ ', RHS => , µ¿ÀÛ =>'do_multiply '} ,],}); $ grammar-> ¹Ì¸® ¾çÈ£ÇÑ (); MY $ RECCE = MARPA :: Àνıâ -> »õ ({grammar => $ grammar}); $ RECCE-> Àбâ ( '¼ýÀÚ', 42); $ recce-> Àбâ ( '°öÇϱâ',); $ recce-> Àбâ ( '¼ýÀÚ', 1); $ recce-> Àбâ ( 'Ãß°¡',); $ recce-> Àбâ ( '¼ýÀÚ', 7); sub my_actions :: do_add {my (Undef, $ t1, undef, $ t2) = @_; $ T1 + $ T2¸¦ ¹ÝȯÇÕ´Ï´Ù. } sub my_actions :: do_multiply {my (Undef, $ t1, undef, $ t2) = @_; $ T1 * $ T2¸¦ ¹ÝȯÇÕ´Ï´Ù. } sub my_actions :: first_arg {shift; ¹Ýȯ ½ÃÇÁÆ®; } My $ Value_ref = $ Recce-> °ª; MY $ VALUE = $ VALUE_REF? $ {$ value_ref} : '±¸¹® ¾øÀ½'; ¿ä±¸ »çÇ× : ¡¤ Perl.
Marpa :: PP. °ü·Ã ¼ÒÇÁÆ®¿þ¾î