Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using adaptive grammars [closed]

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?

like image 432
amorales Avatar asked Sep 23 '10 20:09

amorales


People also ask

How do declarative adaptive grammars vary their rules?

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:

What are recursive adaptive grammars?

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.

What is the difference between formalism and adaptive grammar?

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.

What are dynamic grammars?

Dynamic grammars are a sequence of grammars, with each grammar Gi differing in some way from other grammars in the sequence, over time.


2 Answers

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.

like image 197
Jörg W Mittag Avatar answered Sep 21 '22 01:09

Jörg W Mittag


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.

like image 33
Corbin March Avatar answered Sep 19 '22 01:09

Corbin March