-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Kumir lang support #4477
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
base: master
Are you sure you want to change the base?
Kumir lang support #4477
Conversation
Well, something is wrong. The check for the ability to merge is not completing. |
@Bormotoon for some reason the check for merge is not ending. Couuld you close and re-open this please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend the lexer's simplifying in the suggested way.
// --- Keywords (Core Language) --- | ||
// Keywords are case-insensitive (both lowercase and uppercase Cyrillic are matched). | ||
MODULE : 'модуль'; | ||
ENDMODULE : ('конец' WS 'модуля' | 'конецмодуля' | 'конец_модуля'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend simplifying:
ENDMODULE : ('конец' WS 'модуля' | 'конецмодуля' | 'конец_модуля'); | |
fragment: WS_FRAGMENT: [ \t\r\n]+; | |
ENDMODULE : 'конец' (WS_FRAGMENT | '_')? 'модуля'; |
POST_CONDITION : 'надо'; | ||
ASSERTION : 'утв'; | ||
LOOP : 'нц'; | ||
ENDLOOP_COND : ('кц' WS 'при' | 'кц_при'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENDLOOP_COND : ('кц' WS 'при' | 'кц_при'); | |
ENDLOOP_COND : 'кц' (WS_FRAGMENT | '_')? 'при'; |
OR : 'или'; | ||
OUT_PARAM : 'рез'; | ||
IN_PARAM : 'арг'; | ||
INOUT_PARAM : ('аргрез' | 'арг' WS 'рез' | 'арг_рез'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INOUT_PARAM : ('аргрез' | 'арг' WS 'рез' | 'арг_рез'); | |
INOUT_PARAM : 'арг' (WS_FRAGMENT | '_')? 'рез'; |
INTEGER_ARRAY_TYPE : ('цел' WS? 'таб' | 'цел_таб'); | ||
REAL_ARRAY_TYPE : ('вещ' WS? 'таб' | 'вещ_таб'); | ||
CHAR_ARRAY_TYPE : ('сим' WS? 'таб' | 'сим_таб'); | ||
STRING_ARRAY_TYPE : ('лит' WS? 'таб' | 'лит_таб'); | ||
BOOLEAN_ARRAY_TYPE : ('лог' WS? 'таб' | 'лог_таб'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INTEGER_ARRAY_TYPE : ('цел' WS? 'таб' | 'цел_таб'); | |
REAL_ARRAY_TYPE : ('вещ' WS? 'таб' | 'вещ_таб'); | |
CHAR_ARRAY_TYPE : ('сим' WS? 'таб' | 'сим_таб'); | |
STRING_ARRAY_TYPE : ('лит' WS? 'таб' | 'лит_таб'); | |
BOOLEAN_ARRAY_TYPE : ('лог' WS? 'таб' | 'лог_таб'); | |
INTEGER_ARRAY_TYPE : 'цел' (WS_FRAGMENT | '_')? 'таб'; | |
REAL_ARRAY_TYPE : 'вещ' (WS_FRAGMENT | '_')? 'таб'; | |
CHAR_ARRAY_TYPE : 'сим' (WS_FRAGMENT | '_')? 'таб'; | |
STRING_ARRAY_TYPE : 'лит' (WS_FRAGMENT | '_')? 'таб'; | |
BOOLEAN_ARRAY_TYPE : 'лог' (WS_FRAGMENT | '_')? 'таб'; |
// Color constants | ||
PROZRACHNIY : 'прозрачный'; | ||
BELIY : 'белый'; | ||
CHERNIY : 'чёрный' | 'черный'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHERNIY : 'чёрный' | 'черный'; | |
fragment E_OR_YO : 'ё' | 'е'; | |
CHERNIY : 'ч' E_OR_YO рный'; |
ZELENIY : 'зелёный' | 'зеленый'; | ||
ZHELTIY : 'жёлтый' | 'желтый'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZELENIY : 'зелёный' | 'зеленый'; | |
ZHELTIY : 'жёлтый' | 'желтый'; | |
ZELENIY : 'зел' E_OR_YO 'ный'; | |
ZHELTIY : 'ж' E_OR_YO 'лтый'; |
DOC_COMMENT : '#' ~[\r\n]* -> channel(HIDDEN); | ||
|
||
// --- Whitespace --- | ||
WS : [ \t\r\n]+ -> skip; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the previously introduced WS_FRAGMENT
:
WS : [ \t\r\n]+ -> skip; | |
WS : WS_FRAGMENT+ -> skip; |
fragment DIGIT : [0-9]; | ||
fragment HEX_DIGIT : [0-9a-fA-F]; | ||
fragment LETTER : [a-zA-Zа-яА-ЯёЁ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UPPER case is not needed since the grammar sets up caseInsensitive = true
fragment DIGIT : [0-9]; | |
fragment HEX_DIGIT : [0-9a-fA-F]; | |
fragment LETTER : [a-zA-Zа-яА-ЯёЁ]; | |
fragment DIGIT : [0-9]; | |
fragment HEX_DIGIT : [0-9a-f]; | |
fragment LETTER : [a-zа-яё]; |
fragment LETTER : [a-zA-Zа-яА-ЯёЁ]; | ||
fragment DecInteger : DIGIT+; | ||
fragment HexInteger : '$' HEX_DIGIT+; | ||
fragment ExpFragment: [eE] [+-]? DIGIT+; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fragment ExpFragment: [eE] [+-]? DIGIT+; | |
fragment ExpFragment: [e] [+-]? DIGIT+; |
Is this ready to merge? |
There are some minor issues to fix, but generally yes. |
Sorry, not yet. There will be some more changes and optimizations as suggested here. |
Kumir is a Russian algorithmic language primarily used for teaching programming in schools.