John-Leitch / Aphid

A multiparadigm language intended to be embedded in .NET applications or compiled into other languages like Python or PHP. The internals of Aphid are clean and easy to work with, allowing for rapid creation of derivative domain-specific languages.
http://autosectools.com/Aphid-Programming-Language
GNU General Public License v2.0
31 stars 3 forks source link

Create custom dsl #11

Open furesoft opened 3 years ago

furesoft commented 3 years ago

Could you make a tutorial how to make a dsl with Aphid?

John-Leitch commented 3 years ago

Sure, any specific target domain/problem space you have in mind? I can probably whip together something tailored to your goals to help you determine whether the fit is right, and potentially get the things moving for you if it is.

furesoft commented 3 years ago

I am currently working on a Notebook management application for a special handwriting device. The users mostly don't have coding skills. So the dsl has to be more like natural language and less special charackters as possible.

Something like this:

synchronize if today is monday or friday

on connect make backup and show on success "Backup Completed"

furesoft commented 2 years ago

Any updates?

John-Leitch commented 2 years ago

Apologies, I'm in the middle of a move. I will attempt to write and share out a sample around Wednesday or so.

furesoft commented 2 years ago

Ok. Thanks for the information

John-Leitch commented 2 years ago

Apologies for the delay; starting in on this now. Unfortunately my time is sparse, so I'll iteratively share out the pieces are I tackle them, starting with lexer generation and finishing with interpretation/compilation. Speaking of, what approach would you prefer? Interpretation with hooks in .NET, or compilation to a target language?

furesoft commented 2 years ago

I prefer Interpetation with hooks

John-Leitch commented 2 years ago

Care to provide more samples? What you've provided is sufficient, but the more the better. I've heard of language implementations that maintained orthogonal design, separation of concerns, etc. while omitting layers considered standard, such as parsing, but habe never encountered any where it seemed fit.

I say this because your concept paired with Medusa (Aphid's language implementation toolchain and whitebox language capabilities) seem to be shaping up into one of the aforementioned unicorns. The lexer generator specifically is one of the most developed components, capable of (mostly) language agnostic generation of extremely fast lexers that have an extremely simple API and object model that are largely (if not entirely--haven't checked, but maybe) Framework Design Guidelines compliant.

In a bit, I'll have a functional lexer for your language, and I'll defer to you for the call, but I think that may be all you need to get you going. Further syntactic and semantic analysis of the lexemes here seems like it would lead to nothing other than bloat.

furesoft commented 2 years ago
create tool "pdf-gen" for 
  user interface make 1 category-selector called "categories" and make image display called "cover"
  on "cancel" leave dialog and on "ok" execute "test.js"
furesoft commented 2 years ago

any new updates?