Miksilo icon indicating copy to clipboard operation
Miksilo copied to clipboard

Introduce a more rigid structure for languages

Open keyboardDrummer opened this issue 3 years ago • 0 comments

First something unrelated to Delta's:


trait Language[Program] {
  def syntax: Syntax[Program]
  def semantics: Semantics[Program]
}

trait Pipeline[In, Core, Out] {
  def language: Language[Core]
  def inputSyntax: Syntax[In]
  def outputSyntax: Syntax[Out]
  def desugaring: In => Core
  def compilation: Core => Out
}

trait Syntax[Program] {
  def getParser
  def getPrinter
}

And then adding Delta's

trait LanguageDelta {
  def extendSyntax
  def extendSemantics
}

trait CompilationDelta {
  def transformOutputSyntax

  // Pass is added to the end of the pipeline
  def transformProgram
}

trait DesugaringDelta {
  def transformInputSyntax

  // Pass is added to the start of the pipeline
  def transformProgram
}

keyboardDrummer avatar Jan 04 '22 15:01 keyboardDrummer