285 reputation
311
bio website
location
age
visits member for 2 years, 4 months
seen Oct 16 at 1:14

I'm the author of a natural language programming tool called EngScript, which automatically translates English sentences into Python source code.

For reference, I've posted a link to questions with tags that I'm interested in.

I have written some useful macros in sweet.js:

//for repeating if statements
macro ifs{
    rule{
        {$($x {$y...}) ...}
    } => {

        $(if($x){
            $y...
        }) ...
    }
}

//a concise way to define several different functions
macro manyFuncs{
    rule{{$($x ($y...) {$z...}) ...}
    } => {
        $(function $x($y...){
            $z...
        }) ...
    }
}

ifs {
    a{
        b
    }
    c{
        d
    }
}

manyFuncs{
    fullName(firstName, lastName) {
        return firstName + lastName;
    }
    squared(a){
        return a*a;
    }
}

Right now, I'm searching for a parser that can handle ambiguous grammars.

In theory, it would also be possible to create a very concise programming language with implicitly defined parameters:

isDivisibleBy: (foo % bar) == 0
//This is a function with 2 parameters: foo and bar.

isEven: isDivisibleBy(foo, 2)

isOdd: !isEven(param1)

firstCharacter: theString[0]

lastCharacter: theString[theString.length - 1]

firstNCharacters: theString[0:end]

firstCharacterIsLastCharacter: firstCharacter(stringParameter) == lastCharacter(stringParameter)

printEach: for current in anArray{ print current }

http://rosettacode.org/ is one of the most comprehensive programming language references I've ever found.

Optionally-typed programming languages are really awesome: they combine the type safety of languages like Java with the conciseness of languages like Python.

Some cool things that I've made:

Someday, I hope it will be possible to create a programming language that mixes code from different languages into a single file, like this:

Python {
    def foo():
        return "foo"
}
Ruby {
    def bar
        return foo + " was called from Python."
    end
}

Sep
24
awarded  Autobiographer
Aug
19
comment One language to rule them all? (Them being platforms.)
See the answers to this question: How can I write a set of functions that can be invoked from (almost) any programming language?
Aug
6
awarded  Notable Question
May
12
comment Why aren't there automated translators from one programming language to another?
Also, Wikipedia has a fairly extensive list of automatic programming language translators.
Mar
23
accepted Writing an API that is syntactically valid in multiple programming languages
Mar
23
answered Writing an API that is syntactically valid in multiple programming languages
Mar
17
awarded  Organizer
Mar
17
revised SPRING.net Framework and its popularity
Adding a tag
Mar
17
revised Why such popularity with Python?
Tagging
Feb
5
comment The most human language like programming language
EngScript is the most English-like programming language I've seen so far: let y be 3; set x to 2; print{the sum of (x to the power of 3) and 4} is actually valid EngScript code.
Jan
16
comment The most human language like programming language
xTalk is another notable family of structured-English programming languages.
Jun
26
awarded  Yearling
Apr
15
comment programming an expert system
What specific problem is the expert system intended to solve?
Mar
18
comment Writing an API that is syntactically valid in multiple programming languages
To solve this problem, I'd probably need to represent arrays as JSON strings, and then write conversion functions to convert the strings to string arrays in each language. Fortunately, there are already some libraries for this purpose: google.com/…
Mar
18
comment Writing an API that is syntactically valid in multiple programming languages
If that's the case, then would I be better off manually porting an entire API (possibly with 200 different functions) into 8 different languages, instead of writing a single API that is syntactically valid in all of these languages (which would depend on just 10 or 20 language-specific functions in each language)?
Mar
18
comment Writing an API that is syntactically valid in multiple programming languages
@mortalapeman It wouldn't be necessary to implement a completely new programming language. Instead, I could simply use a restricted subset of an existing programming language (such as Java) instead of creating a completely new language. To keep things simple, I'd also need to use a single data type as the input and output of every function. So String[] theStr = ["Hi!"] in Java would become var theStr = ["Hi!"] in JavaScript.
Mar
18
revised Writing an API that is syntactically valid in multiple programming languages
added 14 characters in body
Mar
18
comment Writing an API that is syntactically valid in multiple programming languages
@mortalapeman Each "polyglot" function would only depend on a small number of "language-specific" functions. As soon as I had written a few "language-specific" functions for a particular language, I would be able to port a large number of "polyglot" functions to that language with only a few minor semantic changes.
Mar
18
comment Writing an API that is syntactically valid in multiple programming languages
@ipaul In C, I would implement printSomething as printf(thingToPrint). In Java, it would be System.out.println(thingToPrint). In Ruby, it would be puts(thingToPrint).
Mar
18
comment Writing an API that is syntactically valid in multiple programming languages
@ipaul I'm trying to write an API that will be compatible with as many programming languages as possible. Of course, it would be necessary to write a few "language-specific" functions to handle if-statments and while-loops, and then write an entire function for the body of each while-loop and if-statement.