Closed gingerBill closed 2 years ago
Hi @gingerBill!
The language definition you suggested looks quite good. Do you want to make a PR?
Hi, @gingerBill and @RunDevelopment!
Just a few notes about the code.
'boolean'
. Is nil
a Boolean? And I don’t get what the Boolean _
is.
'operator'
:
[+-\/%~!=<>]=?
captures ,=
and .=
, but these are not operators. [+-\/]
(or [-+,./]
) should be replaced with [-+/]
;
since [+-\/%~!=<>]=?
captures all the hyphens, ---
and ->
find nothing;
the pattern splits %%
, %%=
, ++
, --
, ---
, ->
, ..
, ..<
, ..=
, <<
, <<=
, >>
, and >>=
;
the pattern doesn’t find (
, )
, *
, *=
, :
, ;
, [
, ]
, ^
, {
, }
;
reserved/forbidden operators (++
and --
) are not highlighted in a special way.
The Odin strings are more complex than shown here. "Strings"
and 'characters'
support escaped characters, but don’t allow to escape newlines. `Raw strings`
don’t support escaping. 'Characters'
are escaped sequences themselves.
In addition, there are some ambiguities in the documentation.
\0
prefix."\UNNNNNN"
and '\UNNNNNN'
) don’t work. However, it’s possible that I’ve misapplied them.matrix
is a keyword, but it is not classified as a keyword in the docs.Do you mind if I try to make a PR?
'boolean'
. Isnil
a Boolean? And I don’t get what the Boolean_
is.
Some languages have an extended boolean algebra that includes the bottom type (null, nil, undefined, etc).
And I don’t get what the Boolean
_
is.
That's a good point. _
is something like a discard, right? It should probably be a keyword.
[+-\/%~!=<>]=?
captures,=
and.=
, but these are not operators.[+-\/]
(or[-+,./]
) should be replaced with[-+/]
;
Very good find. Our ESLint rule regexp/no-obscure-range
would have also caught this.
- since
[+-\/%~!=<>]=?
captures all the hyphens,---
and->
find nothing;- the pattern splits
%%
,%%=
,++
,--
,---
,->
,..
,..<
,..=
,<<
,<<=
,>>
, and>>=
;
Good point. Seems like operators still need some polish.
- the pattern doesn’t find
(
,)
,*
,*=
,:
,;
,[
,]
,^
,{
,}
;
Most of these are highlighted as punctuation.
- reserved/forbidden operators (
++
and--
) are not highlighted in a special way.
Prism grammars generally don't care about invalid syntax, it's pretty much undefined behavior. I would suggest to just highlight them as regular operators. Prism isn't a parser or compiler, we don't valid code, we just produce some pretty colors.
- The Odin strings are more complex than shown here.
"Strings"
support escaped characters, but don’t allow to escape newlines.`Raw strings`
don’t support escaping.'Characters'
are escaped sequences themselves.
String are always difficult in modern languages. I'm just thankful that there is no string interpolation syntax to make this even more difficult.
Do you mind if I try to make a PR?
I'm looking forward to it. Thank you!
Language Odin is a general-purpose programming language with distinct typing, built for high performance, modern systems, and built-in data-oriented data types. The Odin Programming Language, the C alternative for the joy of programming. The Data-Oriented Language for Sane Software Development.
Additional resources https://odin-lang.org/ https://odin-lang.org/docs/overview/ https://github.com/odin-lang/Odin
Syntax: