good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Examples or tutorials for Perl grammars?by perlfan (Vicar) |
on Jul 09, 2021 at 05:36 UTC ( [id://11134834]=note: print w/replies, xml ) | Need Help?? |
If it's a bit like SQL, then you'll save yourself a lot of trouble if you can describe first your toy language as a BNF; here's on for SQL-92. From there, sure there are modules that will allow you to create a parser for it. But the question then becomes, what are you going to do once you get the abstract syntax tree (AST), which is what you get once it's "parsed"?
Mind sharing a comprehensive example of usage? It may be that you don't need to invent your own DSL, and what you really need are just a few well chose keywords implemented as a subset of Perl (or perhaps creative use of prototype)? FWIW, the approach to create your own set of DSL keywords is likely more expedient and easier than literally creating your own "language". Did you know Lua started off as a way to describe data? It's also what's used in programs like nmap to implement it's own DSL. Similarly, mysqlproxy uses it. I know you said you need to stick with Perl 5, but Inline::Lua might help.
In Section
Seekers of Perl Wisdom
|
|