130 likes | 259 Views
Tycho. A small extensible language on .Net. Functional Object Oriented Aspect Oriented Language Oriented Extensible!. tycho.googlecode.com. Variables. > a-list := list [1, 2, 3 ] > an -integer := 56 > location := " Interzone !" > location := " Macondo !". tycho.googlecode.com.
E N D
Tycho A small extensible language on .Net
Functional • Object Oriented • Aspect Oriented • Language Oriented • Extensible! tycho.googlecode.com
Variables > a-list := list [1, 2, 3] > an-integer := 56 > location := "Interzone!" > location := "Macondo!" tycho.googlecode.com
Constants > genesis-6-13 = "And God said unto Noah..." > genesis-6-13 = "Noah, a polymath specializing in meteorology and zoology, predicted…" tycho.googlecode.com
Functions > a => a + 1 > add = (a, b) => { a + b } > inspect = (a) => print a a > add (2, 4) 6 > add ("2", "4") "24" tycho.googlecode.com
Objects > noah = object property name := "Noah" property role := "Concerned Citizen" > noah.name "Noah" > noah.role "Concerned Citizen" tycho.googlecode.com
Methods > noah = object property name := "Noah" property role := "Concerned Citizen" method save-biosphere () => // enter code to save biosphere here. > noah.save-biosphere () tycho.googlecode.com
Constructors > create-noah = () => object property name := "Noah" … > noah1 = create-noah () > noah2 = create-noah () > noah1.save-biosphere () > noah2.save-biosphere () tycho.googlecode.com
Actors > simple-actor = actor (self, name, args, ...) => print name, args > simple-actor.save-biosphere () save-biosphere, list [] > simple-actor.save-biosphere ("giraffe", "elephant") save-biosphere, list ["giraffe", "elephant"] > simple-actor.name tycho:runtime:get-property, list [user:name] > simple-actor.name := "Xerces" tycho:runtime:set-property, list [user:name, "Xerces"] > simple-actor[7] Tycho:runtime:get-index, list [7] tycho.googlecode.com
Schemas(or “Jelly” Typing) > rect = struct {width := 40, height := 30} > get-area = (rectangle :: {width, height}) => rectangle.width * rectangle.height > get-area = {width, height} => width * height > fibonacci = method 0 => 1 1 => 1 n > 0 => fibonacci (n – 1) + fibonacci (n – 2) tycho.googlecode.com
Macros > macro increment > function-call ("++" expr) => #expr := #expr + 1 > n := 1 1 > ++n 2 tycho.googlecode.com
Growing a language > macro object ("object" body) => constructor = tycho:runtime:self => #body tycho:runtime:self constructor (tycho:runtime:create-object ()) > macro actor ("actor" body) => tycho:runtime:create-actor (#body) tycho.googlecode.com
More info timmacfarlane@gmail.com http://tycho.googlecode.com/