Live data from Hacker News

I Wrote a Compiler

blog.singleton.io

21–30 of 78 posts

Re: I Wrote a Compiler

#21
post #14

Earlier quoted context omitted.

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/

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 equivale…

Delphi for sure. And while you have to run it on Windows, it can create binaries for Windows, macOS, Linux, and mobile.

https://www.embarcadero.com/products/delphi

Re: I Wrote a Compiler

#22
post #7
post #3

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?

What would you call TypeScript’s tsc, which translates TS to JS? Microsoft would say it’s a compiler: https://code.visualstudio.com/docs/typescript/typescript-com...

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.

Re: I Wrote a Compiler

#24
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.

Re: I Wrote a Compiler

#25

Wait! What are == and != doing in a BASIC language? Heresy! :)

Yeah, I really should have included :-)

Fun to see this post from the deep archive get some interest - thanks for reading!

Re: I Wrote a Compiler

#26
post #14

TinyBASIC is fun and beautifully simple. I wrote a 3-part tutorial for making a TinyBASIC-to-C compiler using Python a few years ago. Let’s make a Teeny Tiny compiler https://austinhenley.com/blog/teenytinycompiler1.html

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/

People too often complain about original BASIC, and forget most dialects moved away from line numbers and spaghetti GOTOs during the 16 bit days, with widepsread of compilers and structured constructs.

I am really glad that I only got to learn C, after getting through Turbo Basic, Quick Basic, Turbo Pascal[0], doing exactly the same kind of stuff urban myths say it was only possible after C came to be.

[0] - On 16 bit systems, I started coding on an 8bit Timex 2068.

Re: I Wrote a Compiler

#27
post #14

Earlier quoted context omitted.

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/

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 equivale…

Delphi, and naturally Visual Basic for .NET with Windows Forms, not forgeting about C#, however it is getting a bit too much featurities lately, and most likely not what the BASIC target audience would like.

Re: I Wrote a Compiler

#29
post #6

>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.

[flagged]

Re: I Wrote a Compiler

#30
> It’s possible to write the lexer and parser entirely by hand

I write mine all by hand. It's the easiest part of a compiler to write, by far. It's also the least troublesome.

One advantage of doing them by hand is better, more targeted error messages are easier to fold in.

Post reply on HN