Ask HN: Have you created a programming language and why?
Excluding school projects and toy languages, who here has created a programming language and why?
I'll go first. 13 years ago I created a specialized language for processing XML data. XmlPl marries the syntax of C, XML and XPath. It is very fast and efficient. It never caught on. See http://xmlpl.org.
246 comments
[ 4.7 ms ] story [ 331 ms ] threadWe were going for a matlab like language but R and Octave weren't deemed ready. For those of you who are already objecting in your head, I'll grant you that I'm not sure we made a good choice here but this was the early 2000s:(
What we were after was a vectorized language that would let you write your quant formulas without having to write loops.
For instance, if you wanted to run say Black Scholes over multiple expiry dates and multiple underlying prices you could pass in a vector of dates and vector of strikes to your model and it would return a grid of results for the permutations of values.
Since this is pretty processor intensive we also had language features for splitting your calculations over multiple machines in your datacenter.
All of this has since been comoditized, but when we started most of this wasn't present.
The company ended up being the calculation engine for calculating risk metrics like VaR for several large banks being acquired by a large financial company, so in that sense it was a success.
The downside of writing our own language was that quants weren't thrilled about having to learn a new language that wasn't a really transferable skill as quants tend to move around from company to company alot.
So the fact that we wrote a language ended up being a barrier to adoption. it also meant that we did a lot of consulting with the banks to get the initial modesl setup, which was good for providing income, but bad in the sense that our good quants soon became our clients good quants.
I had fun with the project, learned some stuff about interpreters, and also learned that infix notation for things like arithmetic is actually pretty neat and we should probably keep using it.
https://github.com/mtinkerhess/puget
I have 2 ideas.
the first comes from the difficulty of using make. I think the make system lacks debuggability, it's not easy to log, break, step through and watch locals.
I feel that building should be handled by a domain specific language, instead of make.
I haven't researched enough though, there may be something similar, only it is not popular yet.
the second ideas comes from the difficulty of documentation.
I'm thinking of a programming language that allows you to describe the block diagram (modules) of your program easily. You need to specify what the interfaces are, how many threads ....
then a diagram can be automatically generated as a document. you then fill the internals of your module, with classes. The idea is always forcing programmers to describe design first, then implement. code and document are mixed, so the document is always up-to-date.
[0] http://ndmitchell.com/downloads/paper-shake_before_building-...
Your second idea is basically UML and some of the tools that exist for it.
I'm mostly doing it for fun, but also to make it easier to use tablesaw for exploratory analytics.
Sure, http-based rpc mechanisms won, but it seems like agents have a lot of promise for parallelism and code deployment.
I was unaware of compilers at that age, and came across a machine code sample which ran about two orders faster than BASIC. That motivated me to "invent" a compiler and create this proof of concept.
The same thing technically applies to any extensible language (i.e. Lisp) but a Forth programmer goes in with the expectation that the first task will be to create an application specific language. Since you have to pretty much create everything you are best off doing that in an efficient way.
https://megous.com/wl
I also created language for describing processes (company processes).
Mostly for fun and to scratch my own itches.
The first was something I did in an intro to CS class. I asked the professor if I could use C++ rather than Pascal for the assignment, and was, of course, turned down. I'm not proud to admit to this, but in a fit of pique, I decided to write my own programming language in Pascal than then submit the assignment in that. The result was something called 'SeqTl', for Sequenced Testing Language. It was basically a stack oriented language somewhat analogous to Forth. There were two stacks, one for numbers and the other for strings, and the interpreter worked by continually parsing strings of tokens. (Think Tcl pre-8). (I did get an A, the professor said I should've gotten bonus points, but in retrospect he would've been within his rights to fail me outright.)
The second was about five years later, while working on industrial process control firmware. My company wanted to allow our customers to specify control algorithms that were able to be guaranteed to run within a given time bound. To achieve this, I wrote a simplified language with a C-like syntax. It lacked constructs like unbounded loops, and the compiler would run an analysis of the control flow graph and throw an error if the longest path exceeded a given projected execution time. This language also used value/status tuples rather than raw scalar values, so it could do things like propagate bad data information through a calculation. (Think NaN propagation through floating point math, but more expressive.)
The third was/is an ongoing project to write a Scheme-like language.
https://github.com/mschaef/vcsh
This codebase started out as George Carette's SIOD interpreter, although I've made a bunch of changes since. (There's now a compiler, first-class hash tables, the reader and writer are now in Scheme rather than C, there is a test suite including benchmarks, a decent REPL, etc.) Back in 2001/2, this started out as the core of a shareware calculator program I was attempting to sell online. The tl;dr on that is that the design was way too ambitous, the market didn't support it, and I didn't have remotely the bandwidth necessary for either the development or the sales. It was and is still fun to hack on, however.
Well, to be fair, in the real world its not too rare for engineers to write custom programming languages to solve their problems (see: this thread). So what you did isn't that far outside of what's really done, assuming you submitted the code for the programming language with the assignment.
That said, I think he would have been within his rights to give you a C for overengineering it :p.
Exactly.
Now I'm creating Intrinsic, a programming language with a modifiable grammar while runtime. Because I found no tool chain, I published pyPEG, which is an compiler interpreter https://fdik.org/pyPEG/ Intrinsic will have a generative paradigm.
https://github.com/djc/runa/
Why? Because in GIMP it's annoying to edit animations with many layers, so I wanted to write a script that would do what I want. But rather than hardcoding a specific action, I wrote it in an extensible way, and the rest is history.
In general, I think non-Turing complete (always terminating) languages are super useful and should be used more often.
A Turing Machine is literally just a tape, a movable reader/writer, and a bunch of states that dictate what the reader/writer does.
As long as you have memory, the ability to write to memory, conditionals, and some form of looping, whether it's a `while` loop, a `for` loop, or a `jmp` or `GOTO` instruction, it's Turing complete.
Note that a conditional jump (`jne`, for example) satisfies both of the latter.
I forgot...
Turing's Tape Machine is a UTM because the tape can be initialized with contents to turn it into any TM. Any calculation for which there is a TM can be done by the UTM (if someone can figure out what to put on the tape).
For instance, the do operator:
Or the loop macro: The 1965 manual for Lisp 1.5 describes the prog construct, which persists into ANSI CL. Inside prog we can have labeled statements to which we can branch unconditionally with go in any direction. Lisp also has mutable variables. The following example from the Lisp 1.5 Programmer's Manual is still valid code today:A non-Turing-complete language is any language which does not have one of those capabilities. Because the bar is so low, most languages you have used in your life are Turing-complete. For example, you can imagine a simple calculator-like language for just writing mathematical expressions. It can do all basic math operations, has conditions, but no ability to repeat things (no loops or recursion). That language is not Turing-complete. You can trivially prove that programs from such a language will finish - they can't not! there's no ability to impede progress.
The proof is easy: just set for all n, f(n) to be the nth program in your toy language in lexicographical order and then set for all n, g(n):=f(n)(n) + 1. This g is clearly Turing-computable (you can modify an interpreter to compute it) and not in your language (a la Cantor).
Consider for example TensorFlow and/or Theano. Before they added the loop and conditional Ops, they were non-Turing Complete. And you could do amazing things with it as it were.
In fact, I took a lesson from that when working on Gorgonia (https://github.com/chewxy/gorgonia) - I don't ever want it to be a Turing Complete language.
yup, always-terminating functions are also called total functions (if they're defined for every input). Which is a related concept to Total functional programming
http://docs.idris-lang.org/en/latest/tutorial/theorems.html#...
While Idris is turing complete for example, it's possible to mark functions and whole modules as total, and let the compiler prove it for you. Wish that more people knew that we have such tools available nowadays
Dhall, a total configuration language.
https://github.com/Gabriel439/Haskell-Dhall-Library
There is Morte and Anna as well, that look like the previous experiments in total languages in haskell.
https://github.com/Gabriel439/Haskell-Annah-Library
But if you can encode the Ackermann function, proof of termination is not very useful in practice - as it may consume arbitrarily large amounts of space and time to evaluate (easily more than the age/size of the universe).
Professionally, no, but I've taken the approach of "I'm writing a compiler" when ingesting someone else's xml schema.
It's very useful when you need to identify and report errors very early.
https://en.wikipedia.org/wiki/Ladder_logic
To give some background: I'm working on a program to allow anyone to create video games. But to add custom functionality, my users need to use some kind of programming/scripting language. Since these are non-technical people, it must be as easy and simple as possible.
Therefore I'm now making a language (called Screenplay) where you don't really have to learn anything. You click 'add action' and a wizard guides you through making your action. You select the subject, then the verb (or action), and then some parameters. Translated to OO: you select the object, method and parameters.
I considered using a visual programming paradigm, but still text gives you the most freedom in expression. It's also easier to create new concepts in text than making a new image that makes sense.
In the long run I want my Screenplay language to resemble OO, where users can define their own objects with methods. It kind of looks like this (remember it's game related):
Methods could be defined as: I want anyone who can read, but not program, to read such a program and kind of make sense out of it.- It comes with a manual. You shouldn't need a manual for something simple.
- Too much prose, I like more structural things. If inform is a book, my Screenplay is technical documentation.
Inform is great for what it does, but I guess I needed something slightly different.
The major issue with all of this is that program code is built through a process of iteration: one brick on top of another. But once you hit the wall I just described, you have to face the scientifically organized structure of programming in order for the language itself to not be a mess (see PHP) or the programs written in it to be spaghetti (see BASIC and particularly GOTO).
I say this not to be a downer, just as strong encouragement to take this into account and try your best to factor this into your design. If you can make something that lets people scale really high before hitting that wall (if at all!), that would be awesome.
That's like saying "Everyone knows how to drive a car, you just keep it pointing forward and engage the engine".
Everything needs some sort of documentation, whether it be through examples (the way love2d.org/wiki is done, for example, is both informative and useful), documentation, BNF, etc. The fact that a manual exists is not a detriment, but a success -- you have enough features and complexity worthy of documenting it (although I don't mean to imply that larger is bigger :) ).
It is probably fine for the purpose of simple gaming scripts.
I'd suggest you market it as a really simple programming language. That'll work. What you've got technically looks good an sounds like it could be useful, so, cool, but you just need to change how you're selling it. Realize that people who can't logically structure and rationally think and technically design will continue to be unable to program, of course, no matter how easy the tool is to use.
Remember most people are functionally illiterate and can't read at a high cognitive level. That probably correlates very strongly with being unable to program BTW.
(edited to add, this was the wisdom of the GUI. Plenty of people are too illiterate and non-technical to ever be able to use languages, including even English prose, as a computer UI. But if you strip out most of the functionality and change it from linguistic IQ skill points to 2-D spatial manipulation, lots more people can "use" that UI... Nobody ever got noobs to use computers via every "simpler" and dumber CLIs, that madness leads to CPM and msdos, the trick was to get lower intellectual functioning people to use computers by taking away power/complexity and abandoning language and literacy entirely by going spatial with GUIs, I'm just saying as a strategy making the tool weaker never helped people who can't use tools as a historical strategy)
[0] https://en.wikipedia.org/wiki/Clickteam
After reading the article about RUST, I have been thinking about how a compiler could take source code and write it back with fixes/suggestions right into the source so if you make a silly mistake, the compiler can just say "I think you meant..." and offer to fix it for you.
In your language, it would be beneficial to avoid "Syntax error!" and implement something like "Did you mean...", or have synonyms like "says", "exclaims", "talks", etc that compile to the same thing but add flexibility (or the compiler automatically re-writes to the preferred syntax)
Fairly simple language, parsed and executed in Perl. I doubt it survived long after I left, sadly.
Because awk sucks and SQL is too constraining.
However, while playing game after game in the evenings, I was always frustrated that I was using the inputs and outputs of my body so inefficiently. Starcraft tied up my eyes and my hands, but I still had time to think about the things I'd be coding if I weren't playing, and wished wholeheartedly that I had a few extra hands so I could play AND code at the same time.
This frustration crept into other activities like the drive to and from classes (and, even more frustratingly so, the long drive to and from home when I visited) and I eventually came up with a plan to let me code while multitasking with things that require my hands (primarily starcraft and driving).
I had taken the traditional compilers class the previous year so I had some experience with lexing and grammars, and set out to make my own voice-first programming language. I called it Bespoke (ha) and uploaded a proof of concept to GitHub[1][2] after it was featureful enough to solve a couple Project Euler problems.
I decided to use Javascript in the beginning so I could take advantage of webkit's native speech to text and get right into the logic without having to deal with processing sound or extracting words from it. After getting a proof of concept up, I expanded the flow control and data structures it supported (piggybacking on JS) and eventually wrote some fun (albeit simple) programs while gaming, but eventually gave up on the project when I realized I could code things up in a similar amount of time by just outlining code structure while gaming (also using STT) and coding up the necessary snippets in brief downtimes (between games, at stoplights, etc).
Now, I still pretty much do the same: I use a prose-like DSL that's evolved over the years to outline what to code, in what order, and how to tie it in to other pieces. I now take the train/bus instead of driving (and code at will), and outline what to code while I'm dead in Dota 2 games.
[1] https://github.com/drusepth/voice2code/blob/master/voice2cod... [2] https://gist.github.com/drusepth/3134188
When I was playing Diablo II, I used to be able to complete the Secret Cow Level runs with a nova sorc almost by rote. I would often be thinking about other things, chatting with friends, calling into internet radio shows while doing this
I couldn't listen to a podcast and code at the same time either, probably. If I'm listening to a podcast, I'm mentally trying to process it. If I'm coding, I'm mentally trying to plan/process what I've done. Any mental processing from one takes away from the other.
Podcasts, though, don't require any use of your hands. I actually feel guilty _just_ listening to podcasts (or similar) unless I'm also doing something like painting or paperwork that requires hands but not brainpower. I recognize it's kind of irrational, but it just feels like a waste of time and potential when I'm (probably) not going to live forever.
I think it's just a matter of recognizing what your potential inputs (seeing, hearing, touch, processing) and outputs (hands, voice, mental "caches" like outlines that you can context switch back into later) are and choosing activities to multitask that take advantage of the maximum amount of each without overlapping.
I would love to be able to code, using a headset+phone combo, while wandering around in a park.
I think it's still the case, C-like languages have too much grammar going on to deal with without visuals, forth is grammar-free. Also, it's naturally shell-like; instead of your 'run the code', just say the function you need to execute; you can test and redefine each function as you go.
I attempted to build this on a ZX Spectrum in 1983, based on some voice recognition code from a magazine...needless to say I didn't get too far with that hardware. I should have another go.
[1] Sample:
Most users do not want to write their queries by hand, so I also built round tripping of the language to/from a GUI query builder. You can build a query graphically, edit it as text, then go back to the graphical form. Certain things cannot be displayed however, and generating good error messages was very difficult.
A weird fact is that the backend which evaluates the queries has a totally different language of its own, so there is a transpiler for that.
Thousands of people have used this language, but 99% of them did not know it.
1) I wanted to see how far you can go by making every language concept first class, because only first class things can be an abstractions.
2) But another big motivation was that languages usually grow towards building large systems in. I wanted every tradeoff to go to the human side, making it more suitable for beginners. For example, 0.1 + 0.2 = 0.3, slower by not using native floating point numbers, but much more humane. Similar motivation to remove the import statements. Or no difference between object fields or methods, e.g. string.length is the same as string.length().
Part of what I tried is that the smallest subsections of the language would be complete and useful by themselves. Without ever having to say: "this part you do not need to understand yet". That is where the "beginner friendly" part focused on.
Not by making it "simpler" if that would sacrifice first class-ness. Say JS with its global scope promotion, maybe easier, but not first-class, clashes are inevitable.
And for example, the no import thing is based on very predictable scope rules, which can be postponed while learning, but later are completely deterministic and predictable, while still first class, so that the programmer can have control over it if needed.
But in a way it was mostly an experiment to get my thoughts clear on these matters. And for instance the concurrency things in there have less to do with beginner focus.
[0] I think my oldest is "Compiler Construction for Digital Computers" by David Gries. My favorite isn't really a compiler book, it's Wirth's "Algorithms + Data Structures = Programs" because he implements PL/0. I used to have some PDFs by Thomas Christopher that used matrices to computer first, follow, etc sets that I thought was interesting, but have since lost those.