royalapplications / beyondnet

A toolset that makes it possible to call .NET code from other programming languages, including C, Swift and Kotlin.
https://royalapps.com
MIT License
111 stars 5 forks source link

Builder Syntax for creating language constructs #40

Closed lemonmojo closed 1 year ago

lemonmojo commented 1 year ago

Example:

SyntaxBuilder.Swift.GetOnlyVar("name", "String")
  .Public()
  .Static()
  .Override()
  .Throws()
  .Build()

public static override var name: String {
  get throws
}

SyntaxBuilder.Swift.Func("growBy")
  .Parameters("meters: Double")
  .Implementation("// TODO")
  .Build()

func growBy(meters: Double) {
  // TODO
}

SyntaxBuilder.Swift.FuncSignatureParameters()
  .Parameter(label1, name1, type1)
  .Parameter(label2, type2)
  .Build()

label1 name1: type1, label2: type2