dghosef / qdbp

MIT License
51 stars 1 forks source link

Python, prelude, zig #1

Closed spoerri closed 1 year ago

spoerri commented 1 year ago

Congratulations! What a beautiful language!

  1. Would you consider pythonesque indentation levels instead of curly braces?

  2. I notice some nascent support for a prelude (main/lib/runtime.ml)... Why is it in ocaml instead of qdbp? And could you make at least a small mention of it in the docs?

  3. Have you encountered zig? Would you ever consider it for implementing your compiler? And tangentially, the zig project just spent a large chunk of time&effort on self-hosting, and IIRC the lead developer's main take away was that it would've been much easier if had they done it earlier. So... would you consider qdbp for implementing your compiler, soon? 😄

dghosef commented 1 year ago

Congratulations! What a beautiful language!

Thanks! I appreciate it :)

Would you consider pythonesque indentation levels instead of curly braces?

I personally am not a fan of indentation sensitivity. My main gripe is that it makes copy and pasting and thus sharing code harder if the codebase you are copying from is using a different indentation style. So there are currently no plans to have indentation sensitivity.

I notice some nascent support for a prelude (main/lib/runtime.ml)... Why is it in ocaml instead of qdbp? And could you make at least a small mention of it in the docs?

Currently, qdbp compiles to ocaml. The "prelude" is just a chunk of ocaml code that gets put at the top of every ocaml file that qdbp compiles to that includes essential types, functions called at runtime, etc. qdbp's ocaml backend is temporary - I am currently working on a C backend that should be much more efficient and will eventually get rid of the ocaml backend. The ocaml one was just the fastest backend I could whip up.

Thanks for the questions! If you have anymore feedback or other questions, please feel free to let me know

dghosef commented 1 year ago

Oh I missed question number 3. Oops.

I know of zig and in my opinion it is a cool language(and its comptime is really interesting), but I have really enjoyed implementing qdbp in ocaml. In particular ocaml's type system makes compiler writing really nice and gives it the "if it compiles it works" feel(not completely, but much more than most other non-functional languages). I don't feel that I need the low-level capabilities of zig. I do have plans for self hosting, but I think I would do that once the language becomes a little bit more mature. For now, the plan is to work on the C backend, basic optimizations, ironing out the details of the import mechanism, the standard library, and error messages.

spoerri commented 1 year ago

Thank you!