Choose the way to learn programming language Ya

Ya vs C++: Ya features with C++ counterparts is below. Simple Ya samples.

Ya vs C++

Programming Language Ya (pronounce /jˈʌ/) is to perfect C++ and to expand use scope. The starting purpose had been to make: subconsciously readable+understandable the code subconsciously readable+understandable to a greater extent; hence readable+understandable much faster than conventional languages ala C++. Which required huge changes in the basis of the Ya syntax => as a result achieving the subconscious reading+understanding may require a lot of time learning and getting used to Ya. to make the code subconsciously readable+understandable to a greater extent; hence readable+understandable much faster than conventional languages ala C++. Which required huge changes in the basis of the Ya syntax => as a result achieving the subconscious reading+understanding may require a lot of time learning and getting used to Ya. to make the possibility of describing the new syntax (ala yacc). And for the creation of parsers for additions+changes of Ya syntax. preserving or complementing all the C++ features, with the result code execution speed too. C++ had been the basis for improvements. Improvements are invented and gathered from many languages: Ceylon, Scala, Rust, Thelop, JetBrains MPS, XL, http://www.cs.utexas.edu/ftp/predator/wisr-93-p++.pdf" href="http://www.cs.utexas.edu/ftp/predator/wisr-93-p++.pdf">P++; and gathered from papers: http://homepages.cwi.nl/~storm/teaching/reader/Biggerstaff94.pdf" href="http://homepages.cwi.nl/~storm/teaching/reader/Biggerstaff94.pdf">0, http://www.vpri.org/pdf/tr2007008_steps.pdf" href="http://www.vpri.org/pdf/tr2007008_steps.pdf">1. Programming Language Ya (pronounce /jˈʌ/) is to perfect C++ and to expand use scope. Improvements are invented and gathered from many languages: Ceylon, Scala, Rust, Thelop, JetBrains MPS, XL, http://www.cs.utexas.edu/ftp/predator/wisr-93-p++.pdf" href="http://www.cs.utexas.edu/ftp/predator/wisr-93-p++.pdf">P++; and gathered from papers: http://homepages.cwi.nl/~storm/teaching/reader/Biggerstaff94.pdf" href="http://homepages.cwi.nl/~storm/teaching/reader/Biggerstaff94.pdf">0, http://www.vpri.org/pdf/tr2007008_steps.pdf" href="http://www.vpri.org/pdf/tr2007008_steps.pdf">1. Целью создания языка Ya было: сильно ускорить скорость чтения+понимания кода за счёт вкючения подсознательного чтения+понимания _подсознательно_ в большей степени; а значит читаемым+понимаемым _подсознательно_ гораздо быстрее чем у обычных язов аля С++. Что потребовало огромных перемен в основе синтакса Ya и как резалт сделать код читаемым+понимаемым _подсознательно_ в большей степени; а значит читаемым+понимаемым _подсознательно_ гораздо быстрее чем у обычных язов аля С++. Что потребовало огромных перемен в основе синтакса Ya и как резалт достич подсознательного чтения+понимания может потребовать большого времени на изучение и привыкание в Ya. 1.сделать возможность описания нового синтакса. И для создания парсеров и для дополнений+изменений синтакса самого Ya. 2.сохраняя или дополняя все фичи С++, и скорость работы прог тоже. С++ был основой которую ПСено хотел+хочет улучшить. Blocks by tabs. No keywords + Broad use of signs instead of keywords. Sigils (sign prefixes before idents) speed up code understanding by fast instinct: `Lala is type while Lala is function|var. Short standard types specify bit length of data: `0 is void; `1 is bool with values No=False=0 and Yes=True=1=-1; `8 is char; `32 is int; `.32 is float; `.64 is double. Broad use of signs inside types allows to define array- list- hash-like types with convenient short syntax, as `8[] for string (array of chars), `8[][][`8[]] for hash translating string to array of strings: 12 chars instead of 39 chars in C++: Hash<Array<Array<char> >, Array<char> >. tuples examples: 1,2,3 and 1;2;3 - don't require () around; and this example tuple is of type `8;`8;`8. Function args are delimited by ; instead of , to allow entering of tuples without (). struct/Field instead of struct.Field and struct->Field - just as in file paths. __ is ala C++'s this - shorter + faster to enter. Any function is considered a member function, allowing to call it with starting arg first: value/Function(other args) or even value/Function if no other args; yet Function(value; other args) also works. Easy auto access to fields of structure by auto using fields of var __ (ala this), which could be used anywhere. Support for syntax parsers for extended LR(1): DSL Domain Specific Languages, and so it's simple to implement a language a la Graphical User Interface, XML, HTML, .ini. Expandable syntax: define new statements and operators of any complexity, even with syntax loops+options as in regexes. Metaprogramming: compile time execution of any complexity. No project files used: project structure is seen from starting compiled source and sources used from it. Sources are shorter by 20-40%, and even 3 times shorter when specifying or using DSLs.

Ya Summary

Block structure is primaryly described by tabs at start of lines, ala in Python. Tabs at start of line are counted and used for making code blocks ala {...} with no {} used. This feature is even improved by allowing 1-2 chars before the tab to allow prefixed block, as useful for : that works as else inside ? if statement, or works as default: in | switch statement. But blocks made by { and } are also supported. However they must follow the same indent by tabs rule if multiline. Pervasive use of signs and thus no kewords. Sigils (sign prefixes before identifiers) @ ` % # $ $@ : speed up understanding of sigids (sigil+identifier s) by fast instinct. ` is a prefix for types: like `0 void, `1 bool, `8 char, `32 int, `.32 float : see [# Types] below. % is a prefix for annexes (modifiers): like %<< inline; %!+ public; %!0 prohibited; %$@Ya; %$@С extern "C". @ is a prefix for modules ie module file names: @C:/Ya/Yaco/Ident.Ya, @Std/StdIo with .Ya auto added if no extension written. # is a prefix for compile time execution items: as #? is compile time if. C++ also supports compile time execution but only through #define #if #ifdef and template-s, feeble for complex cases. $ is a prefix for nonterminals, used to describe syntax parsing ang generation. Syntax is intro into syntax. $@ is a prefix for syntax language name. Sigid started by sigil may continue by digits or signs; but var or function name, which are not prefixed by sigil, should start by usual letter char [A-Za-z] or by _ if digits or signs are required at start. Signs inside sigids are allowed, yet are to be terminated by letter or digit or _ . _ also allows to start signs after letters and digits: like `-+!A `^_ `^__^_. _@#$_ is correct var name, while _@#$ is wrong: signs don't terminated. Statements are named by signs: ? | * *? =^ =| ^^ ^@ ^| ^^? ^@? Broad use of signs inside types allows to define array-like and hash-like types with convenient short syntax: `8[] is a library defined string (array of `8 chars); `8[][`8[]] is a hash=dictionary indexed by string returning string. And many others, like \ for declaring new sigids (variables, functions, types). Easy auto access to fields of structure with layers of inheritance (as with fields of C++ this) by allowing to inherit from pointer to type with auto dereferencing All statements are greatly enhanced over their C C++ parents, see below. Multiple names for any entity is allowed. Sigids (variables, functions, types) may be named by a number of names. No need to use #define instead. Declaration of a new identifier always starts by \ prefix before each name of identifier, as `+8* \M\Min\Minimum =0 - which declare 1 variable with names M and Min and Minimum - yes: it could by used by any of 3 names. And note that the type of a var is at the end of declaration. Spaces are meaningful. Expressions: No operator precedences specified and used. Closer operands and operators are of higher priority. Like 1+2 * 3 & 100h is ((1+2)*3)&0x100. Definition of multinamed variable, function, type requires to use no spaces between \\names. Numbers are enhanced. As 100h. 20d. 0101b. 111o. 13.25h. 13.25h@-10101b for 0x100; 20; 0b0101; 0o111; 0x1325/16./16.; 0x1325/16./16.*pow(10, -0b10101); Unusual radixes supported: as 9Hwz is 9*(10+'w'-'a') + (10+'H'-'A') Modules, ala #include and no project file. Named modules: \@FileName at the start of each source file. Module name is sigilled (started) by @ and module name is module's file name. Example: @C:/Ya/YaParser.Ya and @Ya/YaParser and @YaParser - all cases are Ok for this file, directory (folder) of file can be specified fully, partially or not at all. And all modules used inside a module are located from the root of module name at start. Header files are not used. Instead dependencies (ala includes) are specified after module name. Like \@"Module Name with Spaces" :@module0 :@module1 :@module2 ... So separate header and implementation for a module does not used, since modules with : prefix after \@ModuleName gets interface of modules into work but not implementation details. No project files used as a result. Each Ya project has main or starting source that is specified for compiler. Main source includes module dependencies at start, so that all required modules will be included and compiled. As a result a separate project file is not required. Syntax description and parsing support. Including implementation and use of DSL. Such as GUI, XML, HTML each of which could be implemented as a library. And allowing broad range of syntax additions - like new statements, complex operators, complex constants for new types, and use of DSL Domain Specific Languages inside Ya code. Support for databases and internal structures like databases - ala SQL - using a library which uses DSL. Ok to write expressions that works with a number of tables, which are sets (f.e. arrays, lists) of fielded type (of class), and perform join where sortby of SQL. In C# it is named LINQ Language Integrated Query. Operators are simple to define. Let's declare = = ie assignment for type `T : \a `T* \= \b `T* `T*.. Both args and return type are specified as pointers - this is since there are no references at all in Ya and since working with pointers is simple, no need to dereference or getting address, all this is automatically inserted. More full checking of types with using of requirements specifications for parameters for types and functions. Also error messages become more appropriate and in time since both requirements and their application when such type or function is used are checked for compatibility to requirements at start of its use, not as in C++ when the use is checked only by production of a valid code from type or function code.

Advantages of Ya vs C++

Already described features are Advantages of Ya vs C C++, but they give rise to other ones. Sources become shorter by 20%-40% than the equivalent С++ code for simple cases; and can be at times shorter when using DSL, as in case of describing Graphical User Interface or accessing XML and HTML. It also makes it easier to make changes. As a result Ya is applicable for any task. This is possible even when some not included extra features are required: they could be added to Ya by implementing DSL Domain Specific Language, as for expert systems; logic programming; GUI through usage of convenient DSL for description of windows layout and content and feedback actions. The only ;) Disadvantage: Ya is very peculiar language, so really requires study. Else Ya code looks as an odd mix of signs, like `+8*-*- \P2\Ptr2\PtrToPtrToChar - you are to guess it defines a variable with 3 names of type const pointer to const pointer to unsigned char. Versus now familiar char unsigned *const *const PtrToPtrToChar which is times longer, and with only 1 name. Yet this deficiency is natural for real improvements. All other features are Advantages ;)

Block structure is described by tabs at start of lines

Like in Python. Tabs at start of line are counted and used for specifying code blocks {...}. But blocks made in single line with { and } are also supported. Typical Ya program has near to no one { and }. 1-2 character prefixes before the tab is also allowed: it just eliminates 1 extra line used by this prefix. See example at ? statement

Statement delimiter dot . is used, more appropriate for statements which are equivalent to phrases, instead of common ;.

And . is not required if no other statement follows on the same line. Which is mostly.

Declarations are always started by \ and being declared idents. You see the declared idents first, and so the code is clearer and faster to grok.

And for variables and functions are finished by type: As `1 \IsIt for bool IsIt;

Types

Types use sigil ` . Ya type specification is much shorter than C++'s: no spaces used, no keywords const signed unsigned. Examples show Ya code and the same C++ code, counting characters: `+32*-*- 8 chars vs int unsigned *const*const 25 chars. Type modifiers are always signs, any sign sequence is possible, and arguments are allowed, such as for associative arrays (hashes) which are written for dictionaries like `DictEntry[`8[]] (here `8[] is an array of chars with added extra functions for string handling). `+8 unsigned char is used for signed char for working with characters and strings: unsigned is chosen for indexing of arrays by characters and for character comparisons. `8[] Ya standard library array of chars and it's descendants `8[>], `8[<], `8[^], `8[=], `8[+] are used for strings, using basic arrays (which are not predefined types but ordinary standard library types), not special string type, since Ya arrays support most required features of strings, and string addons are added specifically for character arrays (addons are allowed). `8, `+8, `16, `+16, `32, `+32, `64, `+64 are most used integer types, being written 2-5 times shorter than char, unsigned char, short int, unsigned short int, long int, unsigned long int, long long int, unsigned long long int. `I:* is integer with a length of pointer: for use for arithmetic on addresses, like in memory allocators and garbage collectors. `.32, `.64, `._ float, double, long double show by . dot that they are floating point numbers. All types are considered fielded types (so called classes), for example it is possible to inherit from `32. New types similar to typedef are described like here: \`ConstInt32 = `32-. \`PtrToUnsignedChar = `+8*. Keyword class is not used. Instead you just write \`MyClass { body of fielded type } No references &, only pointers * are used. References in C++ is a feature with side-effects and is of value only since no need to write *reference to dereference a reference. But the same is with pointers in Ya, even more, see below. Work with pointers is simple, no need to dereference or getting address, all this is automatically inserted. Example: \ptrptr `32**. \i = ptrptr `32. - here in i = ptrptr; is automatical double dereferencing a pointer. Specification of requirements for args of types and functions is added, like a not included feature of C++ 2011.

Statements use blocks {...} always instead of single statements

Just to prevent erros. And most blocks are tab specified.

Multiple names for any entity is allowed

Variables, functions, types may be named by a number of names. No need to use #define instead. Example: `+8* \Begin \Start \Min declares a variable of type `+8* = pointer to unsigned char which is usable by any of it's names Begin or Start or Min.

Broad use of signs

Since signs are shorter and no English used. Sigils (sign prefixes before identifiers) @ ` % # $ instantly give the nature of items. \ is a prefix for declarations of smth new: \`MyNewType starts the declaration of the new type `MyNewType; `1 \MyNewVar declares `1 variable MyNewVar. All statements are named by signs instead of keywords: ? | * *? =^ =| ^^ ^@ ^| ^^? ^@? - is for else. -? is for else if. | is a case in syntax declaration.

All statements are named by signs and greatly enhanced over their C C++ parents typedef struct class enum if switch for while do...while break continue. List of sttatements:

Detailed description see [Statements|statements].

\`NewTypeName ... <- typedef and class and struct

typedef **\`StringAsInC = `8* **typedef char* StringAsInC; class and struct **\`MyOwnString { `8* \At. `+32 \Len **struct MyOwnString {unsigned char* At;unsigned int Len; } Fields are public by default.

`Type \Var = StartValue <- Type Var = StartValue;

**`+32 \Min \Minumum =0; \Max \Maximum = 0FFFFFFFFh . `8* \CStr0; \CStr1 **unsigned int Min=0, Max=0xFFFFFFFF; #define Minimum Min #define Maximum Max char *CStr0, *CStr1; } In C type has base and additions, and this additions are to be copied for each variable. In this example * is copied for each variable. Ya supports multiple names for a variable. This could be emulated using #define.

||| <- enum

enum statement is extended:enums are not only `32 but of any type, the type is specified. Example: \`StringEnum ||| `8[] { \Str1 = "lala" . \Str2 = "bebe" \`ErraType ||| `+8 // i.e. they are unsigned bytes { \eFatal. \eErr. \eWarn. \eMess.

? :? : <- if else if else

**? condition0 { then0 block :? condition1 { then1 block : else block } **if(condidtion0){ then0 block else if(condidtion1){ then1 block else { else block }} Ya code: Note that else block is started by : and tab before else block, thus eliminating the line with only : which is equivalent to } else {. C code: 2 extra lines are used: } else { and terminating } condition0 and condition1 may include variable declaration: **? `8[] \arg0 = CommandLineArgs[0] { // if there are some command line args. . process arg0 } **char* arg0 = argv[1]; if(arg0){ process arg0 }}

| <- switch}

**| ex { case00; case01; ... { block for cases0 case10..case11 /* for range of cases */ { block for cases1 : { block for default case }} **switch(ex){ case case00: case case01: ... { block for cases0; break; case case10: case case11: ... { block for cases1; break; default: { block for default case; break; }}} Each case starts without case or any sign, and terminates without : after case values. Case values can include many values and also ranges value..value, like in 0..3; 7 - this case works for 0,1,2, (no 3 since 3 is not inclusive upper bound), and 7. | switch by any type is possible. This is done primarily for strings. Case code is a block, as usual. no ^^ break required at the end of each block for casesN since auto exit from the block is entered, eliminating all futile break-s. Yet if next block for cases N+1 should be executed after block for cases N then you are to write ^| continue at the end of block for cases N.

* <- foreach:

*** \item<SomeArrayOrOtherSequence . ... using item **// foreach to be added foreach(item in SomeArrayOrOtherSequence){ ... using item }} Or shorter: * <SomeArrayOrOtherSequence ... which is equal to * \it<SomeArrayOrOtherSequence ... so that item is auto named \it Many sequences could by iterated at once by using many different <seq0 <seq1... * F(<seq0: <seq0; <seq1) Function F is called with 3 args being items from seq0, the same from seq0, and from seq1.

*? <- for, while and do while:

***? pre; cond; inc ... **for(pre; cond; inc){ ... }} and ***?; cond ... **while(cond){ ... }} and ***? // no pre; cond; inc ... ^^!! do_while_condition **do { ... while(do_while_condition); } ; inc or both ; cond; inc or all pre; cond; inc could be omitted. cond may include variable declaration:

^^ <- break and ^@ <- continue loop and ^| <- continue to next case in switch allow breaking from and continuing for multiple levels, and so to remove goto-s used in C C++ world to implement it.

As ^^*?|* or the same ^^ *? | * is equal to goto to the end of nested *? (for while do...while) and | (switch) and * (foreach) at once. Examples to be written.

*? <- do...while and combined statement ?+ <- if(cond) continue;

***? ... ^^? !! postCond **do { ... while(postCond); }

*? <- Pascal repeat...until and combined statement ^^? <- if(cond) break;

***? ... ^^? untilCondition **repeat ... until untilCondition; } So *? effectively covers all for, while, do...while, repeat...until.

=^ <- return

Example: **`32(`32 \arg) \Double =^ arg*2 **int Double(int arg){ return arg*2; }}

Support for implementation and usage of DSL Domain Specific Languages allows to extend Ya syntax and to implement another language parser simply.

- Чую надо DSL заменить на синт+парсер гены: а то слова про DSL пусть красивше но не дело Возможность добавлять новые операторы Возможность добавлять новые читалки констов: аля 17:23:00 Возможность добавлять новые нонты: но тут надо придумать хор примеры - ээ! это ж GUI - т.е что пока зову DSL. Ну и др аля GUI надо _список_ целый и тут его по стро на случай

Sources are shorter by 20-40% if common; and up to times shorter if complex.

As for Graphical User Interface, implemented by DSL. <!-- == Better checking and errors for types with args (for ala <a class=WP title="Wikipedia: C++" href="https://en.wikipedia.org/wiki/C++">C++] templates). partially looks like -->

Ya is applicable for any task, extending suitability of <a class=WP title="Wikipedia: C++" href="https://en.wikipedia.org/wiki/C++">C++]: even hard extra features could be implemented, such as for expert systems; logic programming; Graphical User Interface" href="https://en.wikipedia.org/wiki/Graphical_User_Interface">GUI through usage of designed Domain-specific Language" href="https://en.wikipedia.org/wiki/Domain-specific_language">DSL for description of windows layout and content and feedback actions.

== Удобство работы с проектом No project files used. No need: compiler links all compiled modules if it has to. не нужны аля makefiles из-за компила всегда целой проги в которой все зависимости (типа как #include в С С++) указывают на реализации, а headers нет ваще опции компила в сорце сорцах

double compilation: нужны юзы - это принципиально главное

Sources become shorter by 20%-40%

than the equivalent C++ code for simple cases; and can be significantly shorter when using DSL, as in case of describing GUI. It also makes it easier to make changes. Type specification is much shorter, no spaces used, no keywords const signed unsigned, no English words ala int. As `1`I:* `32 `64 `8 `+8 `8[=] `._ `.32 `.64 for bool int with length of pointer int __int64 char unsigned char ArrayL<unsigned char> long double float double. Blocks by tabs (similar to Python): removes lines with single }; removes { and } itself; and if { occupies whole line then { line is also removed.

History of Ya

Ya /jˈʌ/ had been started as an attempt to make better C++ with the same applicability for any task, just as C++ allows. Yet Ya significantly changes C++ syntax and adds many extra features: so Ya and C++ are incompatible. Many additions has been invented , and many gathered from languages: [WL Ceylon], [WL Scala], [WL Rust], Thelop, JetBrains Meta Programming System, [WL XL]. Ya is designed to allow clean, expressive, concise and lightweight low ceremonial code to be written. - DSL - new sy - double compilation - не нужны аля makefiles из-за компила всегда целой проги в которой все зависимости (типа как #include в С С++) указывают на реализации, а headers нет ваще - опции компила в сорце сорцах Преимущества Ya: - краткая запись: на 30-50% короче чем на С++ для простых участков; и может быть в разы короче при юзе DSL, как например при описании синта - табблоки - много имён у чего угодно - little ceremonial: мало keywords и их тоже разрешено использовать иначе // не пошло, да и может и неверно - хм, тут бы надо подробней - DSL - new sy - сигилы для подсознательного быстрого понимания - не нужны аля makefiles из-за компила всегда целой проги в которой все зависимости (типа как #include в С С++) указывают на реализации, а headers нет ваще - опции компила в сорце сорцах - requ: контроль за юзом типфй - делат ошибки своевремнными и аккуратными и по сути ошибки - double compilation . statement delimiter is a must only before a statement which starts on the same line after another statement. Else not required but could be used anyway. As a result most statements are without terminating statement delimiter. Note that . is used for standard ;. !!Example: Hello World Hello World example is here in 2 cases: As it is planned for future: \@HelloWorld.Ya @Std/StdIo/Print; "Hello, %s!\n"; ProgramArgs/Length > 1 ? ProgramArgs[1] : "World" And as it is already implemented in current compiler: \@HelloWorld.Ya // each module starts by specifying it's name which is file name. Module names are @...s, sigil @ is used for not confusing modules with ids, types... \ specifies a definition of sigil ident that is after \, ie of module @HelloWorld.Ya here. Use @stdio.h // to use printf // это не сработает тк .h будут парсить как Ya, а надо пронести на выход. хм, это ныне не решаемо. %С++ `Int \main(`Int \argc; `Char* \argv) // %C++ specify calling convention. Type name is sigilled `type_name. Array is a library defined type, not a predefined language type. \ before name specifies that it's definition of name: all definitions are always prefixed by \. `Char* \name = argc > 1 ? argv[1] : "World\0"/Min // so program says Hello to start arg in command line if it exists, else to World. World is appended by 0 to make it 0-terminated, as usual for C C++ yet not for Ya where arrays used instead and no trailing 0es. printf("Hello, %s!"/Min; name) // "string"/Min is used to access data field of a start of this string. Ret 0 - In Ya each program first initializes static variables and then executes function main, just like as in C C++. ???- Yet main in Ya differs in its args: there are no separate int argv, char** argc args but `char[][] args : array of strings, which are arrays of chars themselfs. - Function Print is used for outing formatted text. First param specifies a file. It's not specified here, see ; after Print(, so default param value is used, which is Std.Out, that is C's stdout. Note that use of defaults is possible for any param, including first one, even if some next param is specified. - This program outputs to stdout "Hello, World!" if executed with no params. If with params, then it outputs "Hello, " and first param and "!". Other examples see at [Examples of programs|Examples].

Basics of Ya

- Operator precedence in expressions: in Ya spaces around operators are counted and it's used for defining precedence. Example: 1+2 * 3; - it's (1+2) * 3; since no spaces in +2 and 1 space in 2 *. Author's experience shows that it's extremely useful when forgotting operator precedences and also to write less parentheses in simple cases like with * / + -. - ` сигил типов: для фй включает арги и потому арги это явно часть типа а не неявно как в C C++ Java C# где арги пишут после имени ф: тут пример - числа в многих системах счисления - простые примеры примеры на ints: - примеры на FP: - сложные примеры на ints: - сложные примеры на FP: ?