- I need a pretty good parser; Stanford NLP is probably the closest thing. Unfortunately it has to be near-universal so building the required training set could take some time.
- LLVM could be taking over the world; if so, I could get the universal compiler and runtime I need
Tuesday, August 10, 2010
Update
Long time... no posts... but I'm still here, reading and thinking (as of July 31, 2014).
Tuesday, March 23, 2010
Examples from RosettaCode
Type equivalence:
(a == b) = true (a == b) = false
(b) a
or a.castTo(b)
will return a value of type b
or an error (of type b
).
Eval:
eval(\" x \") = x // define an eval (uses current scope/environment) x = 1 eval("x") // 1 eval("x+1") // 2 // you can provide type safety pure(eval("print \"x\"")) // error (with no value) pure(eval("\"x\"")) // x // ^ pure is a cast from an impure function to a pure function, obviously // you can create another eval with null scope: // This is probably not what you want, as the null scope won't do anything evalEmpty = { eval = eval; #parentScope=null; eval(x) }; evalEmpty("1+2") // 1+2 - I told you it doesn't do anything! evalWithScope = { parentScope = scope; eval(x) }; evalWithScope(rootScope, "1+2") // 3 evalWithScope(#scheme#.rootScope, "(+ 1 2)") // 3 x = 1+2 evalWithScope(currentScope, "x") // 3Scopes include
rootScope
, #language#.rootScope
, and currentScope
. You can get more complicated if you want by creating other scopes.
Ethiopian multiplication:
half(x) = x >> 1 // pointfree: half = >> 1 double(x) = x << 1 // pointfree: double = << 1 even(x) = x % 2==0 // pointfree: even = ! (% 2) ethiopian(x,y) = (even(x) ? 0 : y) + ethiopian(half(x), double(y)) x ethiopian y = ethiopian(x,y)
Link time:
Link time will occur between program input and execution at any time that files to link have been specified.Tclkit:
One file suffices for execution of programs.FIFO (usage):
// Init // pick your favorite constructor fifo = new List() fifo = List() fifo = List fifo = [] // Error handling x = peek(fifo) // x = underflow x = pop(fifo) // x = that same underflow index = fifo.push(x) // index = -1, fifo[index] = x = underflow. get it? empty(fifo) //true x,fifo2 = pop fifo // if you're not a fan of mutation or parenthesis fifo2 == fifo // false; underflowing is not ignored // Normal usage fifo.push(1) // fifo = [1] push(fifo, 2) // fifo = [2,1] pop(fifo,x) // x = 2, fifo = [1] no = empty(fifo) //y = false empty(fifo) = true // empties fifo x = fifo.peek() // x = underflow /* fifo.empty = false */ // gives a type error fifo.empty = no // fifo returns to previous state pop(x, fifo) // x = 1
Amb:
// Some cool list syntax set1 = "the" | "that" | "a" set2 = "frog" | "elephant" | "thing" set3 = "walked" | "treaded" | "grows" set4 = "slowly" | "quickly" a/"(.*)(.)"/ amb b/"(.)(.*)"/ = (a$2 == b$1) ? a " " b print (set1 amb set2 amb set3 amb set4)
Dynamic variable names:
name = in.readString(); this[name] = 1; // due to table-object correspondence
API's:
I willSimulate mouse click:
System.Hardware.Input.Mouse.click(x,y)Namespaces because I feel like it. Acceptable targets depend on privilege level and where/how you got x and y.
Run-length encoding:
#brace-style python // because I just don't care anymore for(x in string) run = 1 while(x == x.next) run++ x = x.next out << run << x
Inheritance:
Animal = { eat, noise } Dog = Animal Dog.noise = "Bark!" Dog.eat = "Dog chow" Lab = Dog Collie = Dog Collie.eat = "Scraps from the table" Cat = Animal Cat.noise = "Meow" Cat.eat = "Mice" // = is a pretty powerful operator
Apply a callback to an Array:
array.each(callback) callback(array) array | callback map(array, callback) for( i in array ) callback(i);
Environment variables:
System.Environment["TEMP"]Dependent once again on privilege level
Bitwise operations:
// because bit operations are byte operations a & b = {{00}{01}}[a][b] a | b = {{01}{11}}[a][b] a ^ b = {{01}{10}}[a][b] ~a = {10}[a] // add more here... a << b a >> b a >>> b rotateLeft(a, b) // a >^ b ? rotateRight(a, b) // a ^< b ?
Conway's Game of Life:
grid[_,_] = 0 grid[2,1..3] = 1 neighbors[livecount,cellvalue] = 0 // livecount includes the cell itself neighbors[3,0] = neighbors[4|3,1] = 1 do { print(grid); newgrid[x,y] = neightbors[sum(grid[x-1..x+1,y-1..y+1]),grid[x,y]]; grid = newgrid; } to 3;
Simple Random Distribution Checker:
srdc(generator, times, delta) { distribution = {}; do { distribution[generator.next()]++; } to times; distribution /= times; skew = (max - min)(distribution); if( skew / 2 > delta) print(error) }
Wednesday, February 24, 2010
License
I always worry about what license to release a new language under. There are too many licenses and not enough languages. (or maybe I have that backwards?)
A (biased) summary of some licenses:
A (biased) summary of some licenses:
- GPL
- My language is so unique and powerful that only open-source programmers should be able to use it.
- My language is complete enough that you won't need proprietary programs.
- Beg and plead with me, and I might give you a better license
I will eat your children!- LGPL
- You can use my language, but don't expect support unless you're contributing.
- yadda yadda yadda
- BSD
- I don't care what you do
- This project doesn't do much...
- etc.
- WTFPL
- I don't care what you do.
- Do it.
- CC-BY-SA
- What? Some weird person...
- My software, use it if you want
- CC0
- free stuff!
Thursday, January 21, 2010
Task List
- Create universal language
- Status: Not yet started
- Possibility: x86
- Requirements:
- supports all known language constructs - INCOMPLETE
- converter from previous languages - INCOMPLETE
- Build universal compiler
- Status: Not yet started
- Requirements:
- supports universal language - INCOMPLETE
- supports all architectures - INCOMPLETE
- fast - INCOMPLETE
- Open universal editor
- Status: Not yet started
- Requirements:
- supports universal language - INCOMPLETE
- intuitive - INCOMPLETE
Sunday, January 10, 2010
Wisdom
Wisdom can be found in many places.
A: Calc. III took my virginity.Apparently a bathroom stall is not one of them.
B: It found the area under your curves?
Subscribe to:
Posts (Atom)