Skip to content

Wax compiler in wax - working implementation #25

@jacoblister

Description

@jacoblister

@LingDong- I've made some surprisingly rapid progress on a self hosted compiler implementation, please see:

https://github.com/jacoblister/wax/blob/compiler/examples/compiler.wax

To use, copy the wax code into the Playground and run - this will output javascript , copy and paste into a browser console window, and get - working example programs!

The following programs are working so far:

  • hello world
  • fibonacci sequence
  • n queens problem
  • hilbert curve
  • turing machine example

just uncomment to example to run in the compiler 'main' function to see the others.

I've only been worked on this for about a week in my spare time/weekends, and already have this much working, so I think the minimal wax language might really be on to something. Looking at what it can do so far, I don't think I'll be too far away from having a self hosted compiler working pretty soon, and all in < 1000 lines of code, with embedded examples!

I have also made a merge request for a Brainfu*k implementation as well - getting that working so easily that got me motivated to try to do a compiler:
28ae5eb

Could you please have a look at that and perhaps merge it into the examples if that's ok?

I'll be having a look at the C language target as well after I get all the basic functionality covered. I would be quite interested in collaborating with you as I make more progress. I can do a longer brain dump about thoughts on approaches if you'd like.

Thanks Kindly,

Jacob

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions