I'm trying to implement a language (or family of languages) whose grammar can be changed dynamically. I have found no examples that serve as study cases.
Can you give me some reference to any that are actually used in the real world (even from the academic world)?
Does it make sense to implement a Domain-Specific Languages with a dynamic grammar?
Declarative adaptive grammars vary their rules only over the space of the generation of a language (i.e., position in the syntax tree of the generated string). Jackson refines Shutt's taxonomy, referring to changes over time as global and changes over space as local, and adding a hybrid time-space category:
Introduced in 1993, Recursive Adaptive Grammars (RAGs) were an attempt to introduce a Turing powerful formalism that maintained much of the elegance of context-free grammars. Shutt self-classifies RAGs as being a declarative formalism.
This article provides insufficient context for those unfamiliar with the subject. Please help improve the article by providing more context for the reader. An adaptive grammar is a formal grammar that explicitly provides mechanisms within the formalism to allow its own production rules to be manipulated.
Dynamic grammars are a sequence of grammars, with each grammar Gi differing in some way from other grammars in the sequence, over time.
The most famous current language that has a dynamic syntax is Perl6. The most famous example in general is probably Smalltalk-72.
You might also want to look into OMeta and the rest of the STEPS project from Alan Kay's Viewpoints Research Institute, as well as Val Schorre's original META II.
Also interesting: the π programming language.
XL (Extensible Language) also allows for powerful manipulation of the syntax itself.
The Katahdin programming language offers syntax and semantic changes at runtime. It's an unsupported thesis language so don't expect to use it in production. Still, Chris Seaton's thesis may be a good resource for implementing similar ideas in your own language.
Seaton is cited in this paper describing a macro system for the Fortress programming language. The authors' goal is to make syntactic extension indistinguishable from core syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With