From ChatGPT we can learn:
In programming, "alphabet" generally refers to the set of characters that can be used to write programs
in a particular programming language. This includes letters (both uppercase and lowercase),
digits, punctuation marks, and special symbols that are recognized by the language's syntax.
The alphabet defines what characters are valid for variable names, keywords, operators, and other
elements of the language's syntax.
OpenAI. (2024). *ChatGPT* (3.5) [Large language model].
I agree 100% without comments. The question is how to define this set to allow defining syntax rules atop it.

Tuhin PaulPosted Mar 10, 2024, 5:27 PM
Defining the alphabet for a programming language involves determining the set of characters that are valid and recognized by the language's syntax.
Sam HobbsPosted Feb 24, 2024, 6:13 PM
I do not know what other characters means in that definition. It is probably not relevant to English. Other languages use symbols that perhaps are not considered letters. Many languages use symbols that I think are called icons.
I think this discussion is wonderful. I think it is important to have discussions like this. I wish more people did.
A simple explanation of concrete and abstract classes is that a concrete has implementations for all methods and an abstract class does not. In C# interfaces are abstract classes.
This is a good discussion but it might be appropriate to create a new discussion for new topics.
Mariusz PostolPosted Feb 23, 2024, 11:06 AM
It looks like being not a native speaker is a real relief because I always can blame my nationality in case of misunderstanding. It will make my life easier ??. Seriously, I agree. My point is that inter-human communication is one of the most important things. Therefore let me continue this very interesting discussion. As an Udemy instructor, I have 1345 students from all over the world and only 9,7% from the United States of America. 70.9% of them declare speaking in English. As a university teacher is very important to refer citations from academic sources. International standard is a good reference for me. It is not stable but enough to be cited. For academic fellows, doesn't matter how many times we are referring to a term - one reference usually is enough.
But, you have used citations defining the "alphabet" word:
A relevant dictionary definition of alphabet is:
What the "other characters mean" in this definition? Now we have commenced a real academic discussion. I agree with you and try to omit the word alphabet in the context of programming language as a set of valid characters because in my culture alphabet (is written as alfabet) but it is pronounced identically means a set of letters. Again I am very serious about valid English in the context of software engineering and especially in the context of programming engineering. For me your opinion matters a lot.
The next hard term I have to explain is "concrete class". The term is used in contrast to "abstract classes" but its meaning was questioned by my english speaking students (but not native speakers). They cited usage examples: as "concrete objects like stones" or "a heavy, rough building material made from a mixture of broken stone or gravel, sand, cement, and water". Do we have an engineering slang improving personal communication but not perfect in context of orginal meanning? Translation to pl looks ok for me and doesnt mean "building material" but rather something firm - not abstract.
Thanks for contribution and your thought.
Sam HobbsPosted Feb 23, 2024, 1:31 AM
You ask if I think that the use of the word alphabet in that article is wrong. Yes I do. As I said, it is used only once in that page. Every else in that page it uses other terms for the characters.
A relevant dictionary definition of alphabet is:
It is the customary order part that is especially important, in my opinion. The letters F, M and D are letters of the English language but the alphabet is:
The ordering is important for the common use of the term alphabet in my understanding. Some people are generalizing the term alphabet such that it means the same as letters. That is a problem and it solves no problems. Many people that have not learned English as a primary language seem to not understand that. They might be doing the best they know how to use the proper words. The problem is when people insist upon changing the definition of words in a manner that does not improve the language.
Another example I think of people trying to use the correct word but not understanding adequately is acheive. Currently, the way that word is being used often is the same as if the word do is used. I see the word acheive being used much more than when I was young.
Mariusz PostolPosted Feb 22, 2024, 12:28 PM
Sorry, but let me return to the meaning of the term "alphabet". I have just opened the Java specification as you suggested. From the Java specification we can learn:
"2.1. Context-Free Grammars
A context-free grammar consists of a number of productions. Each production has an abstract symbol called a nonterminal as its left-hand side, and a sequence of one or more nonterminal and terminal symbols as its right-hand side. For each grammar, the terminal symbols are drawn from a specified alphabet."
Do you think that this usage of the alphabet word is wrong?
Mariusz PostolPosted Feb 22, 2024, 11:52 AM
Sam Hobbs many thanks for the comments. As I said, my point is that any domain-specific language, including but not limited to a programming language like Java (I prefer C# but try to find common meaning for selected terms) can be represented by the following domain model expressed by the following UML class diagram.
From this diagram, we can clearly state that the valid set of characters is a foundation for defining the syntax rules of the language. I define syntax as a set of rules we can apply to validate the steams of characters. My point is that grammar refers to a programming language's overall structure and rules, including both syntax and semantics. I prefer to define semantics rules as an independent set (for example, not all programmers know the proper meaning that determines program behavior based on spoken English of keywords like var, lock, async, await, and event, to name only a few), but I am aware that syntax and semantics are tightly coupled with each other.
Again, my goal is to define a simple means of how to define a set of valid characters. It usually is defined outside of the language specification. For example from the ECMA C# specification ( I prefer this language but not Java for some reason) we can learn:
My concern is if it is enough for a programmer to know that the program must be a stream of Unicode characters for C#. From my previous post, it looks like the answer is "yes". Next, my concern is if other languages use different approaches to define the set of valid characters. Again in this context, I am using a bottom-up approach to define a programming language. It means that the set of valid characters must be defined first.
Hopefully, it clarifies all doubts. Let me know how it works for you.
Sam HobbsPosted Feb 21, 2024, 9:57 PM
You still have not specified the purpose of this. I have said that there are formal specifications of languages that are written to be precise enough for a person to write a compiler and runtime of the language but I think you have said that is too formal. Therefore I seem unable to provide a meaningful response. You need to be clear about the question.
You say thanks to semantics a meaning can be assigned to valid character streams but the characters are the syntax or the lexical part of the process.
See The Java® Language Specification at:
https://docs.oracle.com/javase/specs/jls/se11/html/index.html
In Chapter 2. Grammars the term terminal symbols is used to refer to characters, or combination of characters. At one place it does say alphabet but everywhere else it says symbol, goal symbol, terminal symbol and other variations containging symbol. In 2.2. The Lexical Grammar the processing of characters is described. It clearly states that terminal symbols are characters (of the Unicode character set for Java). It says that the lexical grammar (characters) is converted to a syntactic grammar consisting of tokens.
Tokens are something that compilers use internally to them and they have meaning only to the compiler.
Mariusz PostolPosted Feb 21, 2024, 8:40 PM
Because no one from this community is willing to provide an instant explanation addressing this topic I decided to do some research and propose an answer. I will wait for your comments and proposals up to the end of March. After that, I will close this thread.
Based on common sense, let's assume that programming languages or broader domain-specific languages are used to define a computer program implementing an algorithm and data representing information processed by this computer in compliance with this algorithm. Hence, in all cases, we must deal with text that is represented as a sequence of encoded characters making up a writing system. To promote a different languages environment the writing system has to provide the capacity to encode all characters used for written languages of the world. Because it is to be used for human-machine communication it must be readable by humans - it needs a possibility to be rendered on a computer screen. Because it is to be used by a computer it must be also formatted as a bitstream to be stored in one or more text files.
Assuming that the alphabet term means only a set of letters, to define a domain-specific language a set of valid characters must be precisely defined. It means that we need a standard set of characters that can be used as a foundation to define a DSL. Concluding the writing system must established atop a selected characters encoding standard and all characters encoded by this standard make up a set of valid characters for this language. For example ASCII, Latin-1, Unicode encoding forms UTF-8, UTF-16, and UTF-32. All of them are widely accepted international standards. Next, this firm foundation may be used to define surtax as a set of rules we can apply to define the organization and validity of the text elements. Finely thanks to semantics a meaning can be assigned to valid character streams.
Finally, we can state that domain-specific languages, including any but not limited to programming languages, are defined by selecting a set of valid characters usually compliant with standard encoding characters and defining atop this set syntax and semantics rules.
Let me know how it works for you.
Sam HobbsPosted Feb 19, 2024, 12:45 AM
I already said that characters and character set seem totally valid to me. I agree that it is better to say something like character set instead of using more words like a set of valid characters. A few years ago I edited many articles in this website. I noticed that quite often authors would use more words than necessary. Quite often I reduced the number of words used to say things in the articles.
As for US-EN, it is not my intent to insist that United States (US) English be the authority. Personally I certainly consider British English to be authoritive. And I am eager for alternatives that are truly improvements. People whose native language is not English make mistakes and it is frustrating for me when mistakes are recognized as being valid yet they are not improvements.
I make mistakes. When I was editing articles I thought that snaps (pictures) and in-built (I am accustomed to built-in) were incorrect. I have since learned it is common for the British to use those words. I am willing to admit mistakes.
Mariusz PostolPosted Feb 18, 2024, 8:36 PM
SAM HOBBS I completely understand and agree with you that the US-EN language should have priority in promoting communication between people. So many thanks for your contribution. I appreciate your effort. I am aware that most of the C# Corner authors are not native speakers so native language-speaking people are responsible for providing feedback to leverage a common understanding of published text.
Unfortunately, in the case of my question, we must find a proper word to replace questioned by you term
alphabetto be used to replace a long and not precise description like "a set of valid characters". As mentioned by you meta-languages (Backus–Naur form, and Grammar of CSS 2) - and also ABNF I am using - are examples of domain-specific languages (notations) to formally describe any language syntax. In other words, they allow us to formally define the syntax rules of a selected language. Hence, they cannot be used to define "a set of valid characters" because the syntax of any language must be defined atop "a set of valid characters".Maybe it looks like an academic problem, but it is very important for all software developers. I decided to keep working on a definition starting with an example of C# language. For example, from the ECMA specification we can learn:
In the meantime, any comments and suggestion suggestions are welcome.
Still, I recognize this problem as not being solved.
Sam HobbsPosted Feb 12, 2024, 5:57 PM
What concerns me is that people whose native language is not English might use a word incorrectly because they do not know the correct word. If they are trying to communicate properly then I am not criticizing them for not being perfect. A problem is that other people might use the same word the same way. The more that happens the more it is likely to happen. There is an abundant need for the English language to be improved but that is not the way to improve it. Unfortunately many people get upset when we try to help them understand what is correct. That is a big problem.
For some reason I see the phrase make use of used when just the word used would be appropriate. I see the word achieve used when a simpler word, such as do, would be approriate. There are many uses of words and phrases that were uncommon when I was young that are now common that are not improvements.
Mariusz PostolPosted Feb 12, 2024, 5:16 PM
In the past people didn't trust steam machines, electric machines, automation, and cars. Now we have Industry 4.0 which means that we are applying AI (ChtGpt is AI) to control machines. I skipped intentionally autonomous cars, assuming that it is the future. All that can make mistakes and kill people but I am not sure if we can resist innovation even if it is not perfect. This discussion is definitely out of this thread's scope ??.
So let's get to the point, of how to define which characters are valid and belong to the set in concern. It is a set of valid characters but not all characters we know. The set of characters is a mathematical term (it is abstract) but not an engineering term for me because the set content must be precisely defined. What do you think? I cannot find a definition for C#, there is only a definition for .NET describing what we can use at run-time but software developers need to know what we can use at design-time.
Sam HobbsPosted Feb 12, 2024, 4:41 PM
> I asked machine, namely ChatGpt
ChatGpt is known to make mistakes. ChatGpt is not taught only what is correct, it is also taught what is commonly used.
> we can argue with people but It is hard to argue with a machine
There is no need to. The makers of ChatGpt tell us to be aware that mistkes can happen.
> local culture, the traditional meaning of words, etc. have gone
That can lead to miscommunication.
> Therefore to keep engineering a practical subject we need widely accepted terms to avoid discussion.
Definitely. I agree very much.
> we are talking about how to define all valid characters in compliance with programming languages
That word, character (or the words character set), is totally appropriate. No need for a new term.
> maybe we should refer to a character set
Yes, that is what I am saying.
> a brief but generic definition of the set of characters we can use to define programming language
It depends on the language and the official specifications of the language should be very specific about what charqacters are valid for it.
Mariusz PostolPosted Feb 12, 2024, 4:09 PM
Sam Hobbs, I am aware that people unfamiliar with English are misusing the word alphabet therefore I asked machine, namely ChatGpt. Of course, we can argue with people but It is hard to argue with a machine. Unfortunately, today's students, tomorrow will be software developers and they love conversation with Google and now ChatGpt, which is a more sophisticated Google for me. In this case, we are not talking about knowledge learned in ground school but about statistics governed by the Internet. It is a result of the overwhelming global village concept. It is a fact, that local culture, the traditional meaning of words, etc. have gone. Therefore to keep engineering a practical subject we need widely accepted terms to avoid discussion. Now we are talking about how to define all valid characters in compliance with programming languages. ChaIGpt called it the programming language alphabet. It is not related to grammar/syntax rules.
For you, the alphabet means something else, so maybe we should refer to a character set defined by a well-known coding system, for example, ASCII, UTF-8, etc. It could comply with an engineering approach in contrast to the weakly coupled spoken language definitions. The solution is based on existing standardization that is widely accepted.
Anyway, many thanks for your thoughtful comments. Hopefully, it will contribute to the Internet statistics.
In conclusion, my goal is to find a brief but generic definition of the set of characters we can use to define programming language.
Sam HobbsPosted Feb 12, 2024, 2:28 AM
The alphabet consists of letters only. People unfamiliar with English are misusing the word alphabet.
I am not sure I understand your question but perhaps you are asking about the following.
Backus–Naur form - Wikipedia
https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form
That, including variations, is what is usually used to formally describve syntax.
Many compilers are written using Lexx/Flexx or RE2C for syntax and Bison/YACC for semantics. Look for articles about them. The PHP compiler initially used (I think) Flexx but now it uses RE2C. The following shows an official definiton of CSS, both in (I think) a BNF format but also a format usable by FLEX.
Grammar of CSS 2.1
https://www.w3.org/TR/CSS21/grammar.html
Just look for the language's specifications. For example C# is an ECMA standard. The language's specifications will provide precise definitions of syntax and semantics. At least for non-proprietary languages.