If you write a parser as a Ruby object that consumes its method_missing arguments, I guess you could just do full blown NLP or define any context-free grammar as a DSL?

RT @dmitrytsepelev@twitter.com

Check out my experimental gem for creating natural–ish DSLs with Ruby 🙂 Link: github.com/DmitryTsepelev/natu

🐦🔗: twitter.com/dmitrytsepelev/sta

Please, someone tell me not to do this, I don't have the handwidth to spare.

An object with a BNF grammar and an evaluation function, which feeds its method_missing to a shift/reduce parser and returns itself, except when the full input is consumed, when it passes the resulting tree to the evaluation function, and returns the result.

You could probably define a function which within its block argumentt overrides the kernel method_missing, so sentences don't need a set starting word.

And maybe you could use Ruby's method call or block syntax to hack parentheses or curly braces into your DSL?

Sign in to participate in the conversation
Computer Fairies

Computer Fairies is a Mastodon instance that aims to be as queer, friendly and furry as possible. We welcome all kinds of computer fairies!