using hylang for configuration of an application #2462
-
I am bit tired of YAML, and I am considering to use Hylang for configuration of an application. This is one of my first steps in Lisp, so I hope for some help and patience. I still have big gaps here. Let's consider
Now, I would like to put configuration into a file
and then read the file, and parse it with Any suggestions how to do that? I suspect I should start with |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 14 replies
-
Just use |
Beta Was this translation helpful? Give feedback.
-
The Hylang example I have provided works without a problem. I want to save Now, I would like to read the file and parse it
This fails with the following exception
Therefore, I think, I am missing something here. |
Beta Was this translation helpful? Give feedback.
-
I extended my configuration file. It can look now like
Would it be possible to enable scripting in my configuration file? I would like to turn above to
I wonder if I need to turn |
Beta Was this translation helpful? Give feedback.
-
I tried to use macros without Hylang's parser, but finally it clicked - it is all about code generation. Back to using parser then! The prototype of a config reader in the script below. I hope someone will find it useful. Thanks to all for help. I am quite pleased with the result. It is really easy to create your own DSL and
IMHO, this has much more potential, for example comparing to
I am afraid I will see a lot of nails with that hammer. ;) Config file read by the script (
The script outputs
The script
|
Beta Was this translation helpful? Give feedback.
I think this might be a bug, whereby model-pattern parsers can't cope with
Lazy
. I'll have to look into it. (Edit: it's an upstream issue: vlasovskikh/funcparserlib#78 .) In the meantime, try(setv form (list (read-many f)))
.