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.
posted @ 2016-12-08 10:26  bonelee  阅读(4060)  评论(0编辑  收藏  举报