ariya / ama

Ask me anything!
29 stars 1 forks source link

What was your best programming moment? #3

Closed sindresorhus closed 8 years ago

ariya commented 8 years ago

So many of them! Let's me think of a few things worth sharing :smirk:

ariya commented 8 years ago

As I mentioned in #2, I was into hardware (micro-electronics) before having an interest in software.

About 10 years ago, while I worked on a project in our lab, I needed to synthesize a fairly complex logic on an FPGA. It was fun but it was very hard to troubleshoot. Since the board still had tons of available I/O pins, I built a poor man's digital-to-analog converter and fed the output to a VGA monitor. After that, I created a simple logic block that could accept an array of characters and send the right signals to the monitor so that the characters could be displayed.

With a crude 8x16 VGA font (scraped from the BIOS of some old machine), the text looked quite convincing! Now whenever I need to debug something, my logic will use that VGA Controller block to display a message on the monitor, making the debugging workflow a bit more manageable.

Combining both software and hardware, it was a very satisfying experience!

ariya commented 8 years ago

A long time ago (I think I was in my sophomore), I was introduced to Unix, FreeBSD and Linux. Beside being busy with the usual university activities, I still managed to learn a thing or two about Linux. Accidently I found a pair of powerful tools, lex and yacc. After reading enough documentation, I put together a simple math expression parser and evaluator using these tools. With some more effort, I expanded it so that it became a very simple interpreter for BASIC.

I was so excited about it since I used BASIC since high school and I never thought that it was possible to build your own language interpreter, including a BASIC interpreter. I didn't study computer science, my major was Engineering Physics and there was no such Compiler 101 class. The idea of assembling your own lexer, parser, and interpreter really blowed my mind.

Later when my interpreter became a bit more extensible, I actually included it in one of my lab projects (a simplistic variant of an industrial control system, with water pump, valves, etc). The idea was to use the interpreter as a scripting system so I did not have to tweak the code of the system's PID controller all the time.

And yes, till today I'm still fascinated by parsers :smile:

ariya commented 8 years ago

I don't necessarily have the best memory, so let me just say that the two above moments were the ones I would cherish the most!

Thank you.

sindresorhus commented 8 years ago

I always enjoy reading the answer to this question. Thanks for sharing :)