项目作者: Mandarancio

项目描述 :
Do Yourself A Favor: an extensible parser and AST Generator
高级语言: C++
项目地址: git://github.com/Mandarancio/DYAF.git
创建时间: 2018-01-22T00:12:19Z
项目社区:https://github.com/Mandarancio/DYAF

开源协议:GNU General Public License v3.0

下载


DYAF

Do Yourself A Favor is a simple extensible parser and AST generator (and in future compiler).

By default the parser is unable to parse anything and the AST will only contain a block with all the code but
via the Extension class is possible to define new symbols and the extra parsing capabilities.

A simple example is scidown.h extension.

Example

Using the scidown extension on the text:

  1. # Title
  2. Another _line_...
  3. ## A sub-chapter
  4. etc *etc* etc...
  5. # A Second chapter
  6. this is ~not~ a [link](url).
  7. Bla -bla- bla...
  8. This @(ref1) is a reference to something not yet referenced.

DYAF generate the following AST

  1. ┬─ NaN()
  2. ├┬─ Chapter(Title)
  3. │├┬─ Line()
  4. ││├── NaN(): [Another ]
  5. ││├┬─ underline()
  6. │││└── NaN(): [line]
  7. ││└── NaN(): [...]
  8. │└┬─ SubChapter( A sub-chapter)
  9. └┬─ Line()
  10. ├── NaN(): [etc ]
  11. ├┬─ bold()
  12. │└── NaN(): [etc]
  13. └── NaN(): [ etc...]
  14. └┬─ Chapter(A Second chapter)
  15. ├┬─ Line()
  16. │├── NaN(): [this is ]
  17. │├┬─ deleted()
  18. ││└── NaN(): [not]
  19. │├── NaN(): [ a ]
  20. │├── link(link, url): []
  21. │└── NaN(): [.]
  22. ├┬─ Line()
  23. │├── NaN(): [ Bla ]
  24. │├┬─ italic()
  25. ││└── NaN(): [bla]
  26. │└── NaN(): [ bla...]
  27. └┬─ Line()
  28. ├── NaN(): [This ]
  29. ├── reference(ref1): []
  30. └── NaN(): [ is a reference to something not yet referenced.]