Live data from Hacker News

The Rewards of Creating a Programming Language

mikedrivendevelopment.blogspot.com

51–60 of 88 posts

Re: The Rewards of Creating a Programming Language

#51
If you are a developer and you have never written a language, you owe it to yourself to do this at least once.

Writing a language (lexical, syntactic, semantic phase and then code generation) will teach you an incredible amount of things in much less time it would take you to read about these things.

What your language looks like is completely irrelevant, this is strictly about learning from the journey.

And once you've done that, make sure to mention it in your resume: I, for one, will instantly give you brownie points if you mention in your resume that you wrote a language.

Re: The Rewards of Creating a Programming Language

#52

If you’re thinking of writing a language in earnest, you will create something much more valuable if you start from a novel semantics, and only then come up with a syntax to express those semantics, than if you were to start from syntax. The world does not need yet another reskin of Java, but it could use new programming paradigms and new ways of solving problems. As a learning exercise, implementing a language is wo…

If you're looking to build something that people will actually use, you're better off not doing anything novel at all, but rather combining novel ideas that have shown promise in research languages into a package that people might actually want to use for everyday programming. There's a rule of thumb among language designers that your language should either focus on proving out one big language feature , or it should…

Saying that Go "popularized" type classes is ludicrous, especially from a language whose type system is weaker than Java's.

Re: The Rewards of Creating a Programming Language

#53

Earlier quoted context omitted.

erlang's concurrency is actors, which is different from go's CSP. And I nearly spat out my tea when you said that Go popularized something Haskell did; and I haven't even had any tea today.

But didn't Go effectively popularize typeclasses through interfaces?

Duck typing (which is what Go supports) has absolutely nothing to do with type classes.

Re: The Rewards of Creating a Programming Language

#54
I was hired (a long time ago) to write a language for a Very Large Telco Equipment Supplier in Canada in order to support their automated regression testing effort for their digital telephone switches.

It was called, ingeniously enough, "T" (no, not that "T"). As far as I (and cursory Google searches) know, it was never released to the adoring public.

I used lex and yacc (half jokingly referred to as 'ick' and 'yuck') and K&R C for the compiler and VM.

The particular type of testing we were targeting involved writing test cases that would read/write over serial lines to a telephone switch's console program. Therefore, the language needed to have good serial/terminal I/O, and it needed to have amazing string/pattern matching.

I wrote two features that I am still particularly fond of:

- regexps were a built in type. Strings were written like 'hi there' and regexps were written like `hi ..ere` - supported standard unix regexps

- associative arrays. Lots of languages have these now, like python's dict

The cool thing about it was how we tried to allow strings and regexps have a polymorphic relationship at the language level. The statements:

  x == 'some string' or x == `some [^t]ring`
would be valid for strings in x, though the regexp had other operators that didn't make much sense with strings. It got really interesting when we combined the regexps with the associative array:

  dict['hello'] = 4
  dict['help'] = 2

  dict[`he.*`] == [2, 4]   # true

Re: The Rewards of Creating a Programming Language

#55
post #54

I was hired (a long time ago) to write a language for a Very Large Telco Equipment Supplier in Canada in order to support their automated regression testing effort for their digital telephone switches. It was called, ingeniously enough, "T" (no, not that "T"). As far as I (and cursory Google searches) know, it was never released to the adoring public. I used lex and yacc (half jokingly referred to as 'ick' and 'yuck'…

I wonder how one would go about efficiently implementing such an associative array.

I suppose a trie + glue logic (regexp -> NFA -> DFA) could work, for classic (read: actually regular expressions) regexps at least.

Re: The Rewards of Creating a Programming Language

#57

I always wonder about the final conversion to assembly. Do you really need to learn all the instructions, the linking, the binary formats and all that stuff ?

My favorite way is to output C, which is conveniently human-readable for debugging. Many people also like the LLVM back end.

Re: The Rewards of Creating a Programming Language

#58
post #7

Earlier quoted context omitted.

Yes, I've written tools for existing languages, and found just getting the parser right to be a challenge, be it with Emacs highlighting, flex/bison, what have you. Real languages aren't as tidy as the textbook examples.

When I do PL these days, I always start with the editor; e.g. see: http://research.microsoft.com/en-us/people/smcdirm/managedti... Co-designing your editor with your language allows for a better experience. You are right in that all of this is basically undocumented in textbooks. Even their presentation on on parsing is mostly unhelpful (if you want an error tolerant incremental parser for your editor, recursive desc…

That is really cool. This focus on time is what draws me into the whole clojure/datomic world. We're ill equipped to handle it. Tools help.

Does time itself reveal itself as the horizon of being?

Re: The Rewards of Creating a Programming Language

#59
post #57

I always wonder about the final conversion to assembly. Do you really need to learn all the instructions, the linking, the binary formats and all that stuff ?

My favorite way is to output C, which is conveniently human-readable for debugging. Many people also like the LLVM back end.

I new about that possibility but how efficient is it compared to other techniques ?

Re: The Rewards of Creating a Programming Language

#60

If you’re thinking of writing a language in earnest, you will create something much more valuable if you start from a novel semantics, and only then come up with a syntax to express those semantics, than if you were to start from syntax. The world does not need yet another reskin of Java, but it could use new programming paradigms and new ways of solving problems. As a learning exercise, implementing a language is wo…

Indeed. Recently I was inspired to learn K, a language in the APL family. There aren't many implementations available, so I wrote my own. Doing this forced me to come to terms with a whole range of features I might have otherwise shied away from using.
Post reply on HN