dsl

How can I fix my DSL grammar to parse a problem statement?

How can I fix my DSL grammar to parse a problem statement? Question: I’ve been tasked with creating a grammar for a legacy DSL that’s been in use for over 20 years. The original parser was written using a mess of regular expressions, so I’ve been told. The syntax is generally of the "if this …

Total answers: 2

How Pony (ORM) does its tricks?

How Pony (ORM) does its tricks? Question: Pony ORM does the nice trick of converting a generator expression into SQL. Example: >>> select(p for p in Person if p.name.startswith(‘Paul’)) .order_by(Person.name)[:2] SELECT "p"."id", "p"."name", "p"."age" FROM "Person" "p" WHERE "p"."name" LIKE "Paul%" ORDER BY "p"."name" LIMIT 2 [Person[3], Person[1]] >>> I know Python has wonderful introspection …

Total answers: 1

Mini-languages in Python

Mini-languages in Python Question: I’m after creating a simple mini-language parser in Python, programming close to the problem domain and all that. Anyway, I was wondering how the people on here would go around doing that – what are the preferred ways of doing this kind of thing in Python? I’m not going to give …

Total answers: 6