miden-vm icon indicating copy to clipboard operation
miden-vm copied to clipboard

File extensions for library files

Open hackaugusto opened this issue 2 years ago • 5 comments

Currently we use masm for both a program and a library file. And we use masl for the compiled version of the library. The issue is that the syntax of a program and a library differs slightly, namely the export keyword is only allowed to be used in one of these contexts.

I think we should add another extension to make the intention clear. I would suggest using:

  • masm for programs
  • masl for libraries
  • maslc for compiled libraries

hackaugusto avatar Feb 08 '23 15:02 hackaugusto

I'm a bit hesitant to increase the number of extensions - especially if multiple extensions are used for source files. Most languages get away with using just a single extension for source files. For example, in Rust it is just .rs whether it defines an executable module (i.e., with main function) or not.

bobbinth avatar Feb 08 '23 22:02 bobbinth

Most languages get away with using just a single extension for source files

Not sure I agree, python has .py for source files and .pyi for typing information. c/c++ have .c/.cc/.cpp/.h/.hpp and a few more here and there. Haskell has .hs and .lhs, and so on.

I personally don't mind the extensions, but I would like a way to determine what syntax is valid to write, currently it is not possible to determine it without knowing how the file is used.

hackaugusto avatar Feb 09 '23 18:02 hackaugusto

I would personally prefer a single extension - and a uniform syntax across libraries and executables (with executables typically containing a begin ... end block).

That would also allow for one executable to "import" another executable to reuse its procedures (or its contents could simply be copied over).

Lots of different "flavors" means stuff gets harder to compose and it increases complexity needlessly.

For example, one could make export.* behave the same way as proc.* in executables - meaning you don't have to use different syntax.

bergkvist avatar Jul 14 '23 02:07 bergkvist

Currently, we have have 3 different file extensions:

  1. .masm for source code files (either executable or library modules).
  2. .masl for compiled libraries (collections of modules).
  3. .masb for compiled executable files.

Maybe we should close this issue?

bobbinth avatar Oct 27 '23 04:10 bobbinth

@bobbinth feel free to close the issue. However the problem is not fixed. It still not possible to determine what syntax is valid for masm file without knowing how the files are used.

hackaugusto avatar Oct 27 '23 13:10 hackaugusto