DEV Community

Discussion on: Sadly, I must say goodbye to Leaf (my programming language)

Collapse
 
vitalcog profile image
Chad Windham

So I'm pretty new to the development world. But ever since I started I've wanted to make a toy language of sort as a side project/learning experience. Do you have any advice on how to get started with that? I'm pretty limited on the computer science side of things. I'm an active web developer with experience of only high level languages (both interpreted and compiled). I plan on getting an Arduino simply to play with some Assembly code. I've read the book Code: the hidden language of computer hardware and software and more or less understood the information it presented. (Sometimes much closer to the less side of things...). I became a web developer via a boot camp. And while it was great and did give me the chance to acquire the skillset to jump directly into the workforce. There is SO MUCH MORE I WANT TO DO AND LEARN! The two primary things I want to accomplish in the near future are:

  1. - Write a toy language
  2. - Use relays to create a 4-bit adding machine called "The Nybbler" (get it?)

I'm not somebody who sits around with a bunch of pipe dreams. When I want to do something I go and I try to do it. So if anybody has some good starting point advice on making a toy language. It would be very, very appreciated.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

I got into languages from many different approaches. Doing a full language stack is a lot of work, fortunately there are many things you can do before that.

  1. Build a simple grammar at first using something like XML or YAML that have existing parsers. It won't be as pretty as you want, but it'll skip the parsing stage.
  2. Create an interpreter instead of a compiler. This is a giant switch statement that reads in the commands and executes them rather than producing a standalone program.

That combination would let you have a minimal toy language working within a day. I've used that combination many times before on DSL's. One time I added an M4 macro layer on top to create a custom syntax.