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

1 Language Grammar to Rule Them All #222

Closed
konsumer opened this issue Oct 14, 2022 · 7 comments
Closed

1 Language Grammar to Rule Them All #222

konsumer opened this issue Oct 14, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@konsumer
Copy link

konsumer commented Oct 14, 2022

I would really like to make a live, syntax-highlighting web editor for umka, but I need a grammar definition for codemirror (or any other similar editor.)

I saw the sublime language file, and tried it in sublime (pretty decent) and the textmate grammar file in the VSCode plugin, and the vim def but none of the automatic converters I found worked with those.

I think a central simple format that can convert to other things like this would make it easier to generate grammars for other things, and here is a nice live-editor for the grammar, but I think it's a bit beyond me.

Related comic:
XKCD Standards

@konsumer
Copy link
Author

Possibly related to #220

@vtereshkov vtereshkov added the enhancement New feature or request label Oct 16, 2022
@vtereshkov
Copy link
Owner

@konsumer If the "grammar" you're talking about is just the lexical contents (i.e., highlighted tokens), I suppose it's quite easy to write a CodeMirror syntax definition file by hand. If you find a syntax definition file for Go, its adaptation for Umka will be straightforward. Having a set of syntax definition files in Umka distributions would be a plus, but only for the most popular editors, like VSCode, Sublime Text, or Vim.

If the "grammar" is a set of syntactic rules, it's defined in the EBNF form in the language specification: https://github.com/vtereshkov/umka-lang/blob/master/spec.md#appendix-language-grammar

@vtereshkov vtereshkov closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2022
@konsumer
Copy link
Author

My thinking is a central format that can produce other formats. For example, I want codemirror live-web-editor for umka (for playground) but I'd need to make the grammar for that by hand (which I am not great at.) I also think it would be useful to have vscode, sublime, etc. If it was all made from the same syntax-hilighting grammar source, we could keep that high quality, and just generate whatever was needed for lots of different targets.

@ske2004
Copy link
Contributor

ske2004 commented Oct 22, 2022

My thinking is a central format that can produce other formats. For example, I want codemirror live-web-editor for umka (for playground) but I'd need to make the grammar for that by hand (which I am not great at.) I also think it would be useful to have vscode, sublime, etc. If it was all made from the same syntax-hilighting grammar source, we could keep that high quality, and just generate whatever was needed for lots of different targets.

I completely agree

@ske2004
Copy link
Contributor

ske2004 commented Oct 22, 2022

that said, EBNF format seems enough

@ske2004
Copy link
Contributor

ske2004 commented Oct 22, 2022

I'll write a converter application

@konsumer
Copy link
Author

konsumer commented Oct 22, 2022

that said, EBNF format seems enough

Yep, agreed, I didn't know about this when I initially asked. I guess all I mean is "let's not maintain like 5 separate grammars, let's make a central one that can be converted into the others programmatically."

I'll write a converter application

Lemme know if I can help. If you can generate a few good ones, I can probly port that to codemirror and ace. Having syntax-hilighting in playground would be sick!

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

No branches or pull requests

3 participants