zydeco-lang / zydeco

a proof-of-concept programming language based on Call-by-push-value
Other
49 stars 3 forks source link

Multiple Files/Modules #6

Closed maxsnew closed 1 year ago

maxsnew commented 2 years ago

To implement a standard library we need to add support for basic namespacing and programming with multi-file programs.

LighghtEeloo commented 1 year ago

We need a notation for basic modules which has

  1. a way to expose bindings, and
  2. a way to import / open a namespace

Any particular notation in mind?

ricky136973 commented 1 year ago

Before introducing export/import grammar, we need to first introduce "global let" right?

LighghtEeloo commented 1 year ago

I agree (that's what I tried to express by "expose bindings"). Do you have any particular syntax in mind?

maxsnew commented 1 year ago

For "global let", we can have

define x : A = a

And we can either make everything public to start or use Rust's

pub define ...
LighghtEeloo commented 1 year ago

Syntax added. I'm not quite sure what semantics it would be though... Should we make them mutually recursive or just separate from each other?

maxsnew commented 1 year ago

I'd say add mutual recursion when we add mutually recursive lets.

maxsnew commented 1 year ago

I'm de-prioritizing this as we can always work around it for now by copy-pasting code. I'll put it on the next milestone.

akaiDing commented 1 year ago

I'm trying to make this feature like: When I put this at the beginning of the file

import std # for example, import the std.zydeco

All the codes in std.zydeco will be attached before the current file and can be used in this file.

LighghtEeloo commented 1 year ago

More details will be further discussed in #12, #44 and #45.