HACKER Q&A
📣 999900000999

How fast could you create a programming language?


As a thought experiment, would it be possible to create a new programming language and teach at least one other person to use it within a week or so.

This hypothetical language needs to support concurrency, networking ( a simple HTTP get request is fine) and IO ( nothing insane, just write a text file and read it back).

Also I'd love to see real life examples of this. Have any of you created a new programming language ?


  👤 Someone Accepted Answer ✓
Apart from the concurrency (but even that could be simplified, I think, by effectively forbidding data sharing), I think it isn’t hard to design and implement such a language.

For example, on today’s hardware it’s easy to write an interpreter for the early microcomputer Basics (only globals, no user-defined functions, at most 26 integers and 26 strings)

You could make it even simpler by not allowing complex expressions. Why allow

  a = b + c / (d + e)
when

  a = d + e
  a = c / a
  a = b + a
works fine, too? Also, if parsing that is too difficult, require users to write that as, for example

  = a + d e
  = a / c a
  = a + b a
or, forth-like

  d e + a=
  c a / a=
  b a + a=
Not ideal? Likely, but teachable to at least one other person? Definitely.

As to others doing something like this: Brendan Eich wrote the first (limited) running version of JavaScript in 10 days.


👤 mikewarot
Long ago, Jack Crenshaw wrote this series[1] about creating a Pascal recursive descent compiler from scratch. I wrote a working pascal compiler from that, back in the day. Similar tutorials exist for many other languages.

1 - https://compilers.iecc.com/crenshaw/

What do you want to do that existing programming languages can't do?


👤 zaphar
If I can implement it as an AST Walking interpreter, Have the syntax be lisp, and leverage most of the runtime of the language I write it in I could produce something in a week and probably teach them to use it for some definition of use as well.

Would it be polished? no. Would it have really good well defined semantics for everything that I might want it to? no. But within those constraints I could probably do it.