Since 1990, I have developed software with C and later C++. Now that I am working on a C compiler, I am learning new things about the language. So, writing a compiler (or an interpretter) can really help to get a deep understanding of a programming language.
npalli 5 hours ago [-]
>The original authors of yacc were Mike Lesk and Eric Schmidt - yes that Eric Schmidt.
Incorrect, they were authors of lex. yacc was authored by Stephen Johnson.
Surprising to me is all the authors are still around, even though the tools are over 50 years old!. Shows how young computer science field is.
musicale 59 minutes ago [-]
Who coauthored "The C Programming Language" anyway? Oh right, prof. Kernighan.
This is very similar to the project I have in Chapter 2 of my new book Computer Science from Scratch [0]. It's also Tiny BASIC without INPUT. I called it NanoBASIC. But it's an interpreter not a compiler. This tutorial is a nice starting point. The chapter is much more comprehensive, so if you want to get into the weeds, I can recommend my own chapter (of course). But it's in Python, not Go. The code is on GitHub[1]. But this tutorial is great too.
I know BASIC is kind of a “bad” language, but there’s something so delightful about it. If we’re plugging TinyBASIC projects that others might find interesting, I made an MMO TinyBASIC REPL the other day: http://10klob.com/
musicale 52 minutes ago [-]
BASIC is an amazing language that computing novices (including humanities majors) could learn in an afternoon, that could be efficiently compiled or compactly interpreted, that was small enough to support dozens of interactive users on a mainframe or minicomputer, or to fit into a tiny 8-bit microcomputer – and yet was largely equivalent to FORTRAN in terms of its expressive power.
I think the closest modern equivalents might be Python (for easy onramp and scalability from microcontrollers to supercomputers) and JavaScript (for pure ubiquity in every device with a web browser.)
I wonder if there is a modern-ish (?) environment that can match Visual BASIC in terms of easy GUI app programming. Perhaps Python or Tcl with Tk (Qt seems harder) or maybe Delphi, or perhaps a modern Smalltalk.
andsoitis 26 minutes ago [-]
Delphi for sure. And while you have to run it on Windows, it can create binaries for Windows, macOS, Linux, and mobile.
>The original authors of yacc were Mike Lesk and Eric Schmidt - yes that Eric Schmidt.
I don't know if it's worth mentioning, but the author of the post is David Singleton, the former CTO of Stripe. I almost hadn't noticed until I saw the domain.
refulgentis 5 hours ago [-]
I worked ~4 layers underneath him when he led Android Wear at Google, and every year or two that happens to me, and it puts a smile on my face. Gotta have love of the game to do this at that level.
IIRC, and man, maybe I'm making it up, but, lore was he always made time on a regular schedule to hack.
Usually 1 layer from the bottom isn't coding so much anymore.
(oddly, I didn't realize he was *CTO* of Stripe until a few months back, when his new thing with Hugo Barra was announced)
musicale 1 hours ago [-]
> Yes, this is what I do for fun.
Don't we all? ;-)
teo_zero 18 minutes ago [-]
Wait! What are == and != doing in a BASIC language? Heresy! :)
matthewmueller 4 hours ago [-]
Love reading these. Keep these blog posts coming!
TMWNN 5 hours ago [-]
I thought a compiler, with no adjective or caveat, should turn a HLL into machine language. Isn't what this describes—turning BASIC into Go—more accurately described as a "pseudocompiler" or "Go compiler" or somesuch? I know Emacs is always said to have a "bytecode compiler" that processes Elisp code, not a "compiler" per se. Am I mistaken?
tuveson 4 hours ago [-]
This kind of question winds up being the CS equivalent of “is a hotdog a sandwich”. I agree that transpiler is a more accurate term for it and that a hotdog is not a sandwich. But there are lots of languages that start life as compile-to-C things. Many compiled languages today output LLVM IR which is not machine language. Similarly people would probably call javac a compiler, even though it outputs bytecode.
fao_ 5 hours ago [-]
Strictly speaking it's a transpiler, but honestly the delta between the target language (Go) and the source language (BASIC) is very fluffy and wooly, from what I remember from my PL theory days the distinction was always fuzzy enough that people used whatever term felt right to them.
An example off the top of my head — Chicken Scheme (call-cc.org) calls itself a compiler but it's target language is C
pxc 5 hours ago [-]
The standard term for this kind of compiler is "transpiler", afaik.
Here's the Wikipedia page for such things, which also taught me several other names for them:
They do, but that article also mixes “transpile” and “compile” often enough that it is near impossible to deduce what different meanings they might ascribe.
ratmice 5 hours ago [-]
So, if he had invoked go for you would it be a compiler?
Another definition is that it translates a source language into a target language.
Incorrect, they were authors of lex. yacc was authored by Stephen Johnson.
Surprising to me is all the authors are still around, even though the tools are over 50 years old!. Shows how young computer science field is.
https://www.cs.princeton.edu/~bwk/
0: https://nostarch.com/computer-science-from-scratch
1: https://github.com/davecom/ComputerScienceFromScratch
Let’s make a Teeny Tiny compiler https://austinhenley.com/blog/teenytinycompiler1.html
I think the closest modern equivalents might be Python (for easy onramp and scalability from microcontrollers to supercomputers) and JavaScript (for pure ubiquity in every device with a web browser.)
I wonder if there is a modern-ish (?) environment that can match Visual BASIC in terms of easy GUI app programming. Perhaps Python or Tcl with Tk (Qt seems harder) or maybe Delphi, or perhaps a modern Smalltalk.
https://www.embarcadero.com/products/delphi
I don't know if it's worth mentioning, but the author of the post is David Singleton, the former CTO of Stripe. I almost hadn't noticed until I saw the domain.
IIRC, and man, maybe I'm making it up, but, lore was he always made time on a regular schedule to hack.
Usually 1 layer from the bottom isn't coding so much anymore.
(oddly, I didn't realize he was *CTO* of Stripe until a few months back, when his new thing with Hugo Barra was announced)
Don't we all? ;-)
An example off the top of my head — Chicken Scheme (call-cc.org) calls itself a compiler but it's target language is C
Here's the Wikipedia page for such things, which also taught me several other names for them:
https://en.m.wikipedia.org/wiki/Source-to-source_compiler