PLY is a zero-dependency Python implementation of the traditional parsing tools lex and yacc. It uses the same LALR(1) parsing algorithm as yacc and has most of its core features. It is compatible with all modern versions of Python. PLY was originally created in 2001 to support an Introduction to Compilers course at the University of Chicago. As such, it has almost no features other than the core
CodeReposã«ãããã®ã¨ãã¯ã©ããã¨æãã®ã§ãåããããããã«å¼µã£ã¦ã¿ãã çµæ§å¤§ããã®ã§æ³¨æ(??) ä¸å¿PLYã¨ããPython Lex Yaccã¨ããã¢ã¸ã¥ã¼ã«ãå¿ è¦ã§ãã®ã§ãé©å®å ¥æãã¦ãã ãããã©ããããè¯ããç§ã«ã¯åããã¾ããã ã½ã¼ã¹ã³ã¼ããè¦ã¦ãããæ°æã¡ãæªããªã£ãã¨ããå ±åãåãã¾ããããã®éãã§ããããã¯ç¸å½ã«æ°æã¡æªãã§ãã Pythonã¬ãã«ã§ãå¿è«ããã§ããããã以åã«ç¡é§ããã£ããå®ç¾©éããããªãã¨ããããäºã«æã£ã¦ããã®ã§ãããã¾ãããããã®ã¯åºãã¡ããã®ã大äºãªã®ã§ã©ãªãããæ°ããå®è£ ãã¦ãããã°è¯ããã§ãããã å¾ããã(forã¨ã)ã追å ãã¦ããã¨ããã話ãé£ã°ãããã®ã§forã¨ããå®è£ ãã¾ããããé¢åãããã®ã§pasteã¯ãã¾ããã import lex from ast import AST import sys tokens = ( 'NU
Welcome! Dabeaz is David Beazley, a computer scientist, educator, and researcher with more than 35 years of experience. Dave has been most visible in the Python community where he has created various software packages, given conference talks, tutorials, and is known as the author of Python Distilled (Addison-Wesley), the Python Essential Reference (Addison-Wesley), and the Python Cookbook (O'Reill
PLY (Python Lex-Yacc) ã§ä½ã Algol 60 å¦çç³» 2008.9.26 - 2008.10.17 - 2008.12.8 - 2009.2.17 (é´) 第ï¼é¨ 1. ã¯ããã« 2. Algol 60 ã¨ã¯ 2.1 Algol 60 ä¿®æ£å ±åæ¸ 3. PLY ã®å°å ¥ 4. åå¥è§£æ 4.1 åå¥è§£æã«ã¼ã«ã®è¨è¿° 5. æ§æ解æ 5.1 æ§æ解æã«ã¼ã«ã®è¨è¿° 5.2 Algol 60 çæè¦åã®ä¿®æ£ 6. ããã¾ã§ã®ã¾ã¨ã 第ï¼é¨ 7. ååã®è§£æ±º 8. ã¤ã³ã¿ã¼ããªã¿ - æã®åæ¹åãªã³ã¯ã¨ goto æ 9. ã¤ã³ã¿ã¼ããªã¿ - æç¶ãã¨ãã£ã¹ãã¬ã¤ã¨ã¹ã¿ã㯠10. ã¤ã³ã¿ã¼ããªã¿ - å¼ã®ä¸ããã®å¤§åè±åº 11. ã¤ã³ã¿ã¼ããªã¿ - call-by-name ã®å®ç¾ 12. ã¤ã³ã¿ã¼ããªã¿ - ã®ããã®è¨èªè¦ç´ 第ï¼é¨ 13. ã¤ã³ã¿ã¼ããªã¿ã¸ã®æ¨æºé¢æ°ã®çµ
Pure Pythonã«ãããlex ããã³ yacc ã®å®è£ LALR(1)ããã³åºç¯ãªå ¥åæ¤æ»ãã¨ã©ã¼ã診æã¬ãã¼ããåããã®ã§ãä»è¨èªã§ yaccãå©ç¨ãã¦ãããªã æ¯è¼çç´ ç´ã«PLYãå©ç¨ã§ãã æ¦è¦ PLYã¯ãlex.py ããã³ yacc.py ã® 2ã¤ã®ã¢ã¸ã¥ã¼ã«ã ply ããã±ã¼ã¸ã«å«ãã§ããã 2ã¤ã®ãã¼ã«ã¯å調ãã¦ä½æ¥ãè¡ã lex.py ã¢ã¸ã¥ã¼ã«ã¯å ¥åãããããã¹ãã æ£è¦è¡¨ç¾ã«ããå®ç¾©ãããåå¥ã®ã³ã¬ã¯ã·ã§ã³ã«å解ããã 次ã®æå¹ãªãã¼ã¯ã³ãå ¥åã¹ããªã¼ã ããè¿ããtoken()é¢æ°ããå¤é¨ã«ã¤ã³ã¿ã¼ãã§ã¼ã¹ã¨ãã¦æä¾ããã yacc.py èªç±ææ³ã¨ãã¦å®ç¾©ãããè¨èªã®æ§æãè©ä¾¡ããã LR ã§è§£æãè¡ããLALR(1) (ããã©ã«ã) ããã㯠SLR ã¢ã«ã´ãªãºã ã§ãã¼ã¹ããã lex.py ã® token()ãç¹°ãè¿ãå¼ã³åºãããã¼ã¯ã³ãåç §ããææ³ã«ã¼
Python, Ply1æ¥çµã£ã¦æ¨æ¥ã®ã¨ã³ããªãèªã¿è¿ãã¦ã¿ãã¨ãSymbolã£ã¦strãç¶æ¿ããã°è¯ãããNumberãintãç¶æ¿ããã°è¯ãããAddProcedureã¨ããã«ãã¤ã³ããã·ã¼ã¸ã£ãProcedureã®ä¸å½¢æ ã«éããªãããSchemeã®ã½ã¼ã¹ã³ã¼ãã1ã¤ã®æååã¨ãã¦æ¸¡ããããããªãã¦ããã³ããããªã£ã¦ããã®ã§ãã¡ãã£ã¨ä¿®æ£ããã Symbolã¨NumberSymbolã¯æååã®æ¯è¼ãNumberã¯ååæ¼ç®ãåºæ¥ãã°è¯ãã®ã ãããPythonã®strã¨intãå ã æã£ã¦ãæ©è½ããã®ã¾ã¾ä½¿ããããã«ãããããããç¶æ¿ãããã class Symbol(str): def eval(self, env): value = env.get(self) while isinstance(value, Symbol): value = value.eval(env) return
Python, Plyååããæ¢ã«4ã¶æããã®éã«JParsecã¸ã®ç±ã¯ãã£ããããã¦ãã¾ã£ã...ã ãã£ã¨ãæ軽ãªãã®ã¯ãªããã¨ãããã¨ã§ãä»åã¯PLY (Python Lex-Yacc)ã使ã£ã¦ã¿ãã ã¾ãã¯ASTã®ã¿ååã¨åãããé¢ç½ããªãããSchemeã£ã½ãæ¸ããããã«ãã¦ã¿ããä¾ãã°ã"(+ 1 2 3)"ã¨å ¥åããã"6"ã¨åºåãããæããã§ããã®ããã®åå°ã¨ãªãASTãçµã¿ç«ã¦ãé¨åãç¨æãããPLYã®åºçªã¯ã¾ã ã # ã·ã³ãã« class Symbol: def __init__(self, key): self.key = key def __str__(self): return self.key def eval(self, env): value = env.get(self) while isinstance(value, Symbol): value = v
åæ Documentation version: $Header: /cvs/projects/PLY/doc/ply.html,v 1.3 2004/05/27 17:30:56 beazley Exp $ PLY Version: 1.5 ç®æ¬¡ Introduction PLYæ¦è¦ Lexã®ä¾ Lexå®è£ ãã¼ã åºæ¬çãªãã¼ã¸ã³ã° yaccã®ä¾ ææ³è¦åé¢æ°ã®çµå 空çæè¦å ææ§ææ³ãæ±ã parser.out ãã¡ã¤ã«ã«ã¤ã㦠æ§æã¨ã©ã¼ã®å¦ç è¡çªå·ã®è¿½è·¡ ASTã®æ§ç¯ Yacc å®è£ ãã¼ã ãã¼ãµã¨Lexer State Management Pythonã®æé©åã¢ã¼ãã使ç¨ãã 次ã«ãã¹ãã㨠Introduction PLYã¯ããã¥ã©ã¼ãªã³ã³ãã¤ã©æ§ç¯ãã¼ã«ã§ããlexã¨yaccã®ãã¥ã¢Pythonå®è£ ã§ããããã®å®è£ ã¯ãå 人ã®
Welcome to the PLY homepage. PLY is an implementation of lex and yacc parsing tools for Python. If you don't have the slightest idea what that means, you're probably in the wrong place. Otherwise, keep reading. In a nutshell, PLY is nothing more than a straightforward lex/yacc implementation. Here is a list of its essential features: It's implemented entirely in Python. It uses LR-parsing which is
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}