python里实现DSL

以后用到的话可以参考如下链接:

http://safehammad.com/downloads/domain-specific-languages-and-python-2011-04-21.pdf

http://www.dabeaz.com/ply/PLYTalk.pdf

http://www.ptmcg.com/geo/python/confs/pyCon2006_pres2.html

Python的DSL无非三种实现思路:

  • PyParsing – An easy to use Pythonic parser where the grammar is written directly in Python.
  • PLY – A more traditional Python parser based on lex and yacc.
  •  import re – Compact and easy to use for simple languages.
原文地址:https://www.cnblogs.com/bonelee/p/6143896.html