3 ms·
That's super interesting. Do you use DCGs to read your data or do you call external libraries? How do you generate C code? Do you use a template system?
by i_don_t_know 2y ago
That's super interesting. Do you use DCGs to read your data or do you call external libraries? How do you generate C code? Do you use a template system?
- xlii 2y agoI rarely use DCGs because they suffer from completeness syndrome, i.e. you either define full DCG or you crash on first error. For such tasks I prefer quasi-quotation [0] or a simple format with goal expansion [1]. As for readers I rarely need ones, because XML, YAML, JSON are already included. In order to do code analysis I first pulled pieces using Regex (mostly headers) and only then parsed them over with DCG. Which is also neat when creating own DSLs - one can ask people on meeting to decorate lightly notes and get - semantic linking almost for free. [0]: https://www.swi-prolog.org/pldoc/man?section=quasiquotations https://www.swi-prolog.org/pldoc/man?section=quasiquotations [1]: https://www.swi-prolog.org/pldoc/man?section=format-predicates https://www.swi-prolog.org/pldoc/man?section=format-predicat...
- i_don_t_know 2y agoThanks! I didn't know about quasiquotation.