An attempt to construct a toy language for learning the process of creating a compiler. Done while reading The Dragon Book and "Let's Build a Compiler!" at a slow and methodological pace.
A general philosophy of KISS is followed, alongside DRY. Goals of this language are the following:
- Object-centric design. Functions and types are all objects, even though they may not necessarily be implemented in the backend as such.
- Reflective programming. This language will strongly support the notion of reflection and observation (such as in KVO as it is found in Objective-C or Swift), with a focus on other languages and interfaces that are fed to it.
- Multi-paradigm. With a focus on declarative programming (functional and logical). The language will possess a fusion of concepts found in the Haskell and Prolog languages with a more fluid and smooth syntax.
- Implicit generics. To avoid more keystrokes, generics are automatically inferred when needed.
Example using PF character generation application where want to model a combat feat "Dodge".
import Pathfinder.Feat
import Pathfinder.Character
import Pathfinder.SRD.FeatList
namespace Pathfinder
Dodge Feat
Temporary = True
Active = Condition (ArmorBonus 1 Character.AC "Dodge")
Expires = When Active Character.FlatFooted
add Dodge SRD.FeatList
Possible syntactic sugar:
import Pathfinder.{Feat,Character,SRD.FeatList}
namespace Pathfinder
Dodge Feat Element(SRD.FeatList)
Temporary = True
Active = Condition (ArmorBonus 1 Character.AC "Dodge")
Expires = When Active Character.FlatFooted