Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Questions about syntax #52
As I'm currently developing a tree-sitter grammar for Lux I've looked at the syntax file you committed and I have some questions:
@eduardoejp Do you have any input on this?
Also some additional questions came up for me:
Sorry for the delay. I've been super busy this week.
You can have as many consecutive commas as you want.
The commas are there exclusively for human convenience, so the parser just strips out any commas that it finds.
Fracs: You can use exponential notation. I forgot to add that to the document.
Revs: You cannot use exponential notation. There are no plans to do so either.
Fortunately, there is less of a need for exponentials while using revs, than while using fracs, because of the range of numbers they cover.
The v0.5 compiler has the sign be optional, but I have since made it mandatory for v0.6 onward.
The code you point to hasn't been worked on in a while and isn't currently being used.
It was written prior to making the sign mandatory.
Your parser should always assume either a positive (
Two separate tags.
Your intuition is correct.
In general, using spaces is a good idea to keep code legible, but Lux doesn't assign any meaning to whitespace.
As far as Lux is concerned, whitespace is allowed purely for programmer convenience.
The only situation when whitespace would be necessary, would be to distinguish different tokens which, if written right next to one another, could be mistaken for a single token.
However, in any situation where 2 tokens can be written right next to one another without ambiguity, no whitespace is necessary.
Both identifiers and tags are comprised of 2 elements, a text which identifies a module, and another text that just identifies the identifier/tag within the module.
This is due to the fact that identifiers are used primarily to give names to definitions, which live inside of modules, and tags are also defined in the context of modules.
The dot (
This is done in this way:
The 2 dots (
Let's say that I'm in module
Later on, I want to use function
So long is I didn't locally import any of the other
There is also a single-dot syntax for identifiers/tags that looks like this:
The single-dot is just a shorthand for referring to the
This is simply because the
It would fail.
The parser would read
Then it would read the second dot (