Lua Where do we use DSLs ourselves?

Cours Lua Where do we use DSLs ourselves?, tutoriel & guide de travaux pratiques en pdf.

Things are somewhat more complex: (I)
I You must detect « syntax sugar » forms (text, handler)…
I …just watch out for types, nothing complicated.
I You have to care for single-call forms (name-only, data-only)…
I …store all proxies after rst call
I and extract data from what’s left after DSL code is executed.
Things are somewhat more complex: (II)
I Error handling not shown…
I …it is mostly argument type validation at this stage,
I but global environment protection aka strict mode is advisable.
I Debug info gathering not shown…
I …just call debug.getinfo() in __call.
I You should keep order of top-level nodes…
I …make a list of them at the « name » call stage.
Format-agnostic DSL loader
Loads DSL data to the in-memory tree.
I Reusability: Works for any conforming DSL without modi cations.
I Output targets: N/A.
I Error reporting: Does what it can, but mostly that is behind its scope.
Bonus DSL syntax construct
namespace:method « title »
: modifier « text »
: another { modifier_data = true }
{
data = « here »;
}
On subnodes: DSL vs plain tables, I
What is better?
foo:bar « name »
{
subnode =
{
key = « value »;
};
}
…Or…
foo:bar « name »
{
foo:subnode
{
key = « value »;
};
}
On subnodes: DSL vs plain tables, II
It depends on the nature of the data.
I If subnode is a genuine tree node, use foo:bar.foo:subnode DSL subnodes.
I But for parameters of the tree node, even when they are stored in a sub-table, use plain old foo:bar.subnode tables.
I When unsure, pick whichever is easier for tree traversal in each case.

Introduction
Ad-hoc approach
A case study
The « proper » solution
Where do we use DSLs ourselves?
Why game-changing?
Questions?

Cours gratuitTélécharger le cours complet

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *