Lead Developer and Solutions Architect, I specialise in Event Sourcing, DDD and Event Driven systems. PHP and GoLang developer. Enjoys being a smart ass and having a nice whiskey.
Location
Ireland
Education
MSc in Computer Science, Trinity College, Dublin
Work
Lead Developer and Solutions Architect at Contractor
Glad you enjoyed the article, and thank you for the feedback.
I've done both ways, written a DSL parser/interpreter and written a fluent interface. You're right about parsers, they can be a huge pain in the neck, especially if you're writing one yourself from scratch.
I like you're suggestion above, a fluent/builder makes a lot of sense. It's not that complex a language so implementing it as a class structure is fairly simple. As you mentioned, IDE auto completion is another big win. Martin Fowler calls these internal DSLs, and it's usually the first step in creating a DSL (and maybe the last step, if it works it works).
In the next article, I'm going to show how a parser for the above can be implemented using a PEG (pegjs.org/ to be precise), ie. an external DSL. However, that's just to showcase the concept. In reality I would implement this language as you suggested.
I think that external DSLs would gain more traction if we could get better IDE support, make it easier to design the language and plug a parser into the IDE itself. Until then they're always going to be clunkier and harder to write.
I'm focused on developing and expanding my knowledge and skills. Enjoying new challenges. I'm assuming that there are no stupid questions, there are only silly answers.
I'll follow your DSL thread and I'll read your article about parser. I was very interested in this subject a few years ago but it was a very hard to find an interlocutor to talk with him/her about DSLs.
Once again great article and I'm glad that you've brought up DSL subject.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Glad you enjoyed the article, and thank you for the feedback.
I've done both ways, written a DSL parser/interpreter and written a fluent interface. You're right about parsers, they can be a huge pain in the neck, especially if you're writing one yourself from scratch.
I like you're suggestion above, a fluent/builder makes a lot of sense. It's not that complex a language so implementing it as a class structure is fairly simple. As you mentioned, IDE auto completion is another big win. Martin Fowler calls these internal DSLs, and it's usually the first step in creating a DSL (and maybe the last step, if it works it works).
In the next article, I'm going to show how a parser for the above can be implemented using a PEG (pegjs.org/ to be precise), ie. an external DSL. However, that's just to showcase the concept. In reality I would implement this language as you suggested.
I think that external DSLs would gain more traction if we could get better IDE support, make it easier to design the language and plug a parser into the IDE itself. Until then they're always going to be clunkier and harder to write.
Thanks for your answer.
I'll follow your DSL thread and I'll read your article about parser. I was very interested in this subject a few years ago but it was a very hard to find an interlocutor to talk with him/her about DSLs.
Once again great article and I'm glad that you've brought up DSL subject.