Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Interesting Properties of the Molecule Language #88

Open
blckngm opened this issue Jan 19, 2024 · 1 comment
Open

Some Interesting Properties of the Molecule Language #88

blckngm opened this issue Jan 19, 2024 · 1 comment

Comments

@blckngm
Copy link

blckngm commented Jan 19, 2024

I have found some interesting properties of the molecule language. I'm not suggesting that you should change the language in any way immediately, just sharing my findings and maybe provide some info if you ever want to evolve the language or the parser.

  • Import path looks like a path but is actually .., / and identifiers and doesn't include the extension. But it also doesn't allow spaces between the components. So it isn't like C #include "../ some-path.h" and also isn't like rust use super:: some_module. It's pretty unconventional IMO. If you ever want to evolve the language, I would recommend adapting either the C include style where the path is quoted and more characters are allowed and the full path (including extension) is spelled or some module import style where whitespace is allowed between components.

  • Keywords are not reserved. You can have a field called struct. (But when you do the generated code doesn't actually compile.)

(I noticed these because I was playing with lexers and was trying to build a lexer for the molecule language but find it really hard due to the above properties: it's hard to disallow whitespace between import path components if you are ignoring whitespace everywhere. And it's hard to distinguish identifiers and keywords if keywords are not reserved.)

@zhangsoledad
Copy link
Member

#96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants