Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Examples or tutorials for Perl grammars?

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11134834]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-18 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found