littlelogs

Keep a social journal of your work progress as you make and learn things.

#go

February 2017

josh
josh

Did a bit more work porting rply to #go this afternoon. Now I’m into building the parser things are getting tricky. #Rply is also barely commented at all so it’s often hard to follow. Also because #python is dynamic, there are no types for anything! So I have to be the human type inferrer. It’s been a bit frustrating working out what type a variable is (or what a dictionary holds) when I can’t see the raw values going in.

josh
josh

Remember I was going to try writing a language (either #braid, or something Braid-like) that compiles to #go? I decided that I should learn Go a bit more thoroughly before getting stuck into that, and I also wasn’t keen on using yacc for the parsing stage — it’s really old, and has a weird syntax. So why not combine the two and start by porting rply (rpython lex yacc, a modern implementation of those tools) to go? At first I thought this wouldn’t be a huge undertaking, and then of course I realised how little I knew. But tonight I got the lexer finished and working! It didn’t take too long at all. 🎉

I grappled with Go a little bit, but didn’t have huge problems. It’s mostly pointers I have to really think about. I agree with those who say the core language is easy to pick up, although I think people conflate (at least I did) “modern” with “high-level”. It’s really not high-level 😐 but that’s why we’re writing a language on top of it, right?

Maybe tomorrow I’ll start porting the parser.

January 2017

josh
josh

Remember my toy language #braid? I’ve been thinking a lot about making something similar that compiles to #go. Go has a lot of benefits, like good concurrency primitives, fast GC, cross-platform compilation, but it lacks some niceties like algebraic data types and generics. Maybe I could write a language that provides these and compiles to go, so it can take advantage of its benefits too, like the many interesting languages that compile to javascript. I’m not sure I can actually implement what I have in mind, but I’m curious to try, just for fun.

Today I got some simple lexing set up using a package called lexmachine. Next I’ll be learning to use yacc so I can plug the resulting tokens into a parser. Small steps.

August 2015

May 2015