I'm looking for some kind of reference which shows the frequency of symbols of popular programming languages. I'm trying to design an optimal keyboard layout for programming.
If there is no such reference, I wouldn't mind creating a simple utility that figures this out. However, I would need suggestions as to which files to analyze for each language.
One of the problems I can foresee is say I get some objective-c code, if it is a simple program with no objects, then the [ and ] keys will be far less frequent than an average objective-c file. So, I would say one of the guidelines is that the sample code should be representative of an average file and use the most commonly used features of the language.
Originally I was thinking that I should get the same code written in different languages, but I'm not sure if that's a good idea since some languages have different uses than others.
Freq will be used to maintain the count of each character present in the string. Now, iterate through the string to compare each character with rest of the string. Increment the count of corresponding element in freq. Finally, iterate through freq to display the frequencies of characters.
The correct answer is Assembly Language. Assembly language uses symbols to represent binary codes of machine-level instructions. The symbols (mnemonics) in Assembly Language are used to represent binary codes that are used in machine language (the most fundamental form of programming languages).
The code snippet for this is given as follows. for(int i = 0; str[i] != '\0'; i++) { if(str[i] == c) count++; } cout<<"Frequency of alphabet "<<c<<" in the string is "<<count; The program to find the frequency of all the alphabets in the string is given as follows.
A symbol in computer programming is a primitive data type whose instances have a unique human-readable form. Symbols can be used as identifiers. In some programming languages, they are called atoms. Uniqueness is enforced by holding them in a symbol table.
For large code samples to use for statistical analysis, you might try browsing popular open-source projects or searching on Koders by language.
I made some simple changes to a QWERTY layout a few years ago, and I've been using it ever since as my general-purpose layout:
_
and -
: names with underscores are common, and now -
and +
both require Shift.[]
and {}
: blocks are more common than subscripts.Plus two optional changes, to taste:
`
and ~
: destructors are common.'
and "
: strings are more common than characters.The last is the only one that typically would interfere with typing ordinary English text. The layout works beautifully for C++, Perl, and whatever else I've used in the past two or three years. The noticeable speed increase comes from the drastic reduction in the need to hit the Shift key. I find that using Shift for the numbers isn't a big deal since the number pad is usually faster anyway.
The book The New C Standard: An economic and cultural commentary contains a lot of measurements of C source usage. The usage figures and tables are available as a stand-alone pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With