HNHacker News
TopNewBestAskShowJobs

patricksli

135 karma · joined May 16, 2016

submissionscomments
patricksli··on Implement a Just-in-Time Compiler from Scratch
Hello!

Are you a programming language nerd? Are you interested in compilers and interpreters? Have you always liked them, but felt apprehensive about actually implementing one yourself?

A few years ago, I had the privilege of teaching a graduate course with Mario Wolczko at the University of California, Berkeley on programming languages and compilers. In the course, we teach you how to implement a non-trivial programming language, starting with a basic abstract syntax tree interpreter, and ending with a just-in-time compiler.

I just posted our course exercises to my website, which walks you through how to implement the programming language from scratch.

Cheers, Patrick

P.S. And if you find that you enjoy this sort of thing, consider working with us at JITX (www.jitx.com) on automating circuit board design. We designed a programming language for making circuit boards!

patricksli··on Launch HN: JITX (YC S18) – Automating Circuit Board Design
Yeah, we know that A.I. is an overused term nowadays. But a lot of our techniques are taken straight out of AAAI proceedings. The problem is too hard to not take advantage of the latest techniques.
patricksli··on Launch HN: JITX (YC S18) – Automating Circuit Board Design
Stanza is our implementation language. If you're interested, you can check out the website www.lbstanza.org. It looks pretty similar to Python, plus it also has types!
patricksli··on Launch HN: JITX (YC S18) – Automating Circuit Board Design
For advanced designs with lots of compliance requirements, our tool isn't yet able to fully-automatically compute the final design. For these designs, the tool does the parts it can and leaves the rest to be handled by an engineer.

We have an internal scoreboard that tracks how much of each job we successfully automate, and we steadily improve our algorithms to make progress on that.

patricksli··on Launch HN: JITX (YC S18) – Automating Circuit Board Design
Our tool can be configured to source parts from specific vendors, such as Digi-Key and Mouser, etc.

We plan to replace most of the needs for prototyping. But there is still about a 3-4 day turn to get your boards back from the fab.

If you have all the parts already lying around, and a breadboard handy, then you could get a breadboard design up faster than you could with our service.

We have Wyisywig tools internally for help during placing / inspecting the board shapes / verifying package footprints etc.

patricksli··on Launch HN: JITX (YC S18) – Automating Circuit Board Design
Yup this is L.B. Stanza!

The tool is still internal for now. We're operating as a design service today, and our own engineers use the tool to produce designs quicker than other human-powered competitors.

patricksli··on Launch HN: JITX (YC S18) – Automating Circuit Board Design
Good question. Jonathan and I both from a lisp background and are used to crafting DSLs out of s-expressions (which is what we normally do).

For JITX, we're using a language called Stanza, which provides decorated s-expressions out of the box. It's basically still just s-expressions, but it looks prettier.

patricksli··on Launch HN: JITX (YC S18) – Automating Circuit Board Design
Thanks!

When we were teaching an electronics design course at Berkeley, we were lucky to have a couple of desktop mills handy.

When we coupled JitPCB with the mills, we could completely sidestep the need for breadboards completely, even during prototyping. We went from code to fabbed board in half an hour.

patricksli··on Launch HN: JITX (YC S18) – Automating Circuit Board Design
Thanks very much for letting us know! For now https://www.jitx.com works fine. We'll have to take a look at our web configuration.
patricksli··on The Design of Stanza's Optional Type System
Ah I have skimmed through the webpage for Pyret before. It's nice to meet you. I have some questions for you about that that I'll ask you later.

What you're describing is, I believe, one particular strategy among many with the goal of allowing users to gradually add type annotations. The goal itself is not new, and is often called optional-typing. The two words "gradual typing" specifically is also one particular strategy for optional typing but is under the ownership of Jeremy since he coined it. Informally, people do seem to use the term in a looser way.

patricksli··on The Design of Stanza's Optional Type System
Optional typing is the general term for such type systems. "Gradual typing" was coined originally in a paper by Jeremy Siek and refers to a specific set of axioms that must be satisfied.

Thank you for the link though. I will see how the term is used colloquially nowadays.

patricksli··on D-Expressions: Lisp Power, Dylan Style (1999) [pdf]
Hello everyone.

Since there's been interest in the D-expressions paper, I wanted to add that Jonathan Bachrach (the first author on the paper) is actually my Ph.D. advisor, and we just released a new programming language a few months ago called Stanza based on similar ideas. Stanza is a spiritual successor to Dylan of sorts: it has an optional type system, coroutines, a multimethod-based object system, programmatic macros, and an s-expression-based natural syntax. You can check it out at www.lbstanza.org.

  - Patrick
patricksli··on Stanza Programming Language Now Supports Windows
The L.B.Stanza Programming Language now has support for 64-bit Windows systems.

Stanza is a new optionally-typed general purpose programming language from U.C. Berkeley. If you're interested, see our original posting at https://news.ycombinator.com/item?id=11717561.

patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
Now it's official. I'll add an announcement to #lbstanza on the website.
patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
The immediate difference is that Stanza is optionally-typed while those three are all purely statically-typed. A dynamically-typed language behaves very differently than a statically-typed language with type inference. For example, Scheme is a very different language than OCaml, even though type annotations are not required for either. In this sense, Stanza is designed to compete against both Python/Ruby as well as Nim/Crystal/etc...
patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
Sure. The paper is called "Type Checking Modular Multiple Dispatch with Parametric Polymorphism and Multiple Inheritance" by Allen, Hilburn, et al.
patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
James Martin wrote a VIM Stanza syntax highlighter. It's not on the webpage yet, but a quick google search will give you it.

Writing modes in Emacs lisp is a little more daunting and we have yet to do it.

patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
Thank you Keno! Congratulations on Julia Computing LLC as well. In a past life, I studied machine learning, and often wished there was a better alternative to Matlab.
patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
Dylan was way ahead of its time.

Now is the time to bring many of its contributions into the light again.

patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
We have a very powerful concurrency mechanism but no support for physical parallelism yet. What this means is that it is easy to write programs containing many things that seem like they're happening simultaneously (eg. video games and multi-user web servers), but you don't get a speed boost for having multiple processors yet.

The standard library currently only provides basic IO, primitive types and collections. We will be attaching a gui library, opengl library, networking library, and regex library soon.

patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
We are planning to add a static method ambiguity check in Stanza.

There are just some theoretical hurdles to solve in order to detect them properly in the presence of parametric types. That's been recently solved (though not by us) so we'll be implementing their solution soon.

patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
Yes. We just realized that as well. We're currently using a font called Menlo that isn't on every platform. We'll be replacing it with more widely available font.
patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
First and foremost, Stanza was designed for myself, to solve the problems that I repeatedly face in my own programming.

I mostly write software that is end-user-facing and interactive, with requirements that aren't known at the beginning of the project. Software that my mother would use, is how I typically describe them. e.g. Word processors, games, calendars, photo albums, spreadsheets, maps, movie players, etc.

And what I saw repeatedly, for all of my projects, was that progress comes a lot faster in the beginning than near the end. Eventually, I pinpointed the problem to one of software architecture. It is easy to see the required architecture for the start of a project, and making progress is easy. As you pile on demands and features, you realize that the architecture that you started off with is wrong, and progress slows. This is especially true if the requirements of your program are not known in advance. I expect people that mostly program well-known and stable algorithms don't have as much difficulty with this. E.g. numerical linear algebra, schedulers, image filters, etc. That is not what I write.

Once you realize that your architecture is wrong, you have two choices. You can either plow ahead with a sub-optimal architecture, and take a small but continual productivity hit. Or you can try to refactor and correct the architecture, and take a large one-time productivity hit. Neither approach is satisfactory. Small continual productivity hits eventually add up to the point that forward progress is seriously impeded. Refactoring also costs a lot of time, and eventually the cost of refactoring becomes too great to be worth it, and you're stuck with the last good enough architecture that existed.

So Stanza was designed to make it possible for me to : 1. Experiment easily without specifying upfront the class inheritance tree in the program. 2. Delay committing to a specific architecture for as long as possible. 3. Refactor the underlying architecture of a program through small local changes.

And for the programs that I write, I sincerely believe that I succeeded. I've been programming exclusively in Stanza for about three years now, and I haven't yet ran into the dreaded "refactor-or-abort" situations that arise often in Java/C++ programming. Radical changes to the underlying architecture of a program are possible by applying a series of small staged local changes. And the optional type system allows me to get a lot of features working without having to commit to an architecture, so that when I finally sit down to properly design the architecture it is much more likely to be correct.

So my ultimate goal with Stanza is to help you achieve a linear rate of progress across the project timeline. You should feel as productive near the end of the project as you did in the beginning of the project.

patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
We're still working on a paper on comprehensive performance measurements, but we don't expect to see the same slowdown.

Very intentionally, we called Stanza an "optionally-typed" language instead of a "gradually-typed" language. The moniker "gradual typing" was coined by Jeremy Siek and implies a very specific semantics and implementation style. One of the drawbacks of gradual typing is that obtaining good performance can be tricky.

Stanza does not use the same system, and we are not seeing the same problems. But the experiments and paper are still in progress.

patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
A comprehensive benchmark suite is in the works.
patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
Li Bai was no slouch in the lushi form either. And I'm just a big fan myself.
patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
Thank you for taking a look. We also believe in a "batteries-included" approach and are, in order of priority, writing interfaces from Stanza to:

1) The QT gui library.

2) The GLFW OpenGL and input events library.

3) Some networking library.

4) Some regex library.

The current compiler generates x86-64 assembly code, but we're working on refactoring that and abstracting it to make it easier to write more backends. We are aiming particularly for a Javascript backend for webapps and an ARM backend for mobile apps.

patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
Thanks very much!
patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
We're working very very hard on that right now. It'll be out in a few weeks.
patricksli··on Stanza: A New Optionally-Typed General Purpose Language from UC Berkeley
It's in the works. We recognize that it is an important part of a modern language.
Page 1 of 2Next →