-
Notifications
You must be signed in to change notification settings - Fork 85
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
How does it work? #33
Comments
Hey there! :)
I will think about your other suggestions, but I have to go through the docs and posts you linked first. The plaintext AST is mostly used for debugging purposes (the JSON one is not really used), and for that it's better if it is less compact and shows more information like the type of the internal representation, the variable's inferred type, etc. It also helps that one node is usually one line, so I can diff before-after states, so e.g. after I modify something in the compiler and I regenerate all the tests, I see in Git in an instant if some representation changed and I can decide if it is a bug or it is something I indeed want. For example here I can see that the compiler indeed understood that the call returns a So, I will look into your projects later, but I don't promise a quick answer, I am pretty dormant nowadays regarding OneLang... |
Thanks for your answer. I would say that it never hurts to have a more compact representation... for example, consider
In LESv3, the same information could be expressed with something like
The attribute notation for types is a bit clunky here, admittedly, because the low precedence of the attribute marker
[edited] In this example I've introduced the "is." operator and the "is+" operator. These are known as "combo operators" (combination text and punctuation). Because of the dot, the precedence of "is." is the same as the dot operator, and similarly for "is+". So we can mentally parse the expression as follows:
|
I'm curious about lots of things about this project, but a few jump out right away.
As the inventor of LES I'm a bit biased, but I can't help but think that this project could benefit from using it. For example, compared to JSON or plain text, LES would provide a much more compact and intuitive way to express your ASTs.
Perhaps we could collaborate... for a brief time period starting right now, I have a lot of involuntary free time on my hands. Your primary language seems to be TypeScript, and it would be an interesting exercise to try to port my C#-based LES parser and printer to TypeScript... maybe using OneLang itself to help me do it! What do you think, if I did that, would you be interested in using LES somewhere in OneLang?
Then there's my Enhanced C# parser... if I could port that to TypeScript, you'd have access to a high-quality C# parser (though it doesn't quite support C# 7 yet.) Since the EC# and LES parsers were generated by the same parser generator (which I also wrote), if I can manage to port the LES parser to TypeScript, the EC# parser should be a pretty easy follow-up.
The text was updated successfully, but these errors were encountered: