473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How does one become a C operator?

I mean for example if I wanna make a new programmin language how to make a operator?
if I write = what should I do to let my programming language know I mean what work?
I can explain my question more if you want.
thank you.
Jan 4 '10 #1
8 2531
Banfa
9,065 Expert Mod 8TB
It would be the language compilers responsibility to either compile the language syntax into the correct assembler for the platform (or if you were using gcc into intermediate code) for a compiled language or the interpreters responsibility to interpret the language syntax and perform the correct operation for an interpreted language.
Jan 4 '10 #2
hi thank you but if I want to add a new syntax and function for it what should I do?
Jan 4 '10 #3
Banfa
9,065 Expert Mod 8TB
It's your language you define the syntax and you define how it should be handled.
Jan 4 '10 #4
Idon't know how to add a syntax.for example if I type a syntax how to define it so that when the compiler see it,does the work I want.can I explain my problem clearly?:(
Jan 4 '10 #5
Banfa
9,065 Expert Mod 8TB
Hmmm, you initially said
I mean for example if I wanna make a new programmin language how to make a operator?
which appears to indicate that you are trying to write a completely new language (a fairly major feat in itself).

However I am beinging to get the impression that may be you think you can add an operator to the C (or C++) language. If the later is the case then the simple answer is you can't add operators to languages, or rather that you probably shouldn't, in theory you could do something like get the source for a compiler and modify to include a new operator.

In C you extend the language by adding functions. In C++ you could extend the language by adding functions but on the whole a better approach would be to add classes (object definitions). In C++ you can override most of the existing operators for your new classes should you wish, however you still can't create your own operator.

If you really want to create your own language I would suggest that you start by reading the specifications of some existing languages. Also you should have a clear idea of what improvements your new language would provide over the language it is supposed to replace.

If all you really want to do is implement some operator you perceive to be missing from C/C++ then write a function.
Jan 4 '10 #6
weaknessforcats
9,208 Expert Mod 8TB
Create a Backus-Naur chart for your language.

You can use that to write your compiler.
Jan 4 '10 #7
I'm amateur in C .so what is Backus-Naur chart?:(
Jan 5 '10 #8
Banfa
9,065 Expert Mod 8TB
Wikipedia has a good introduction.
Jan 5 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

37
by: Curt | last post by:
If this is the complete program (ie, the address of the const is never taken, only its value used) is it likely the compiler will allocate ram for constantA or constantB? Or simply substitute the...
8
by: Douglas | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** Hello, The following code does not compile if line 3 is uncommented "using namespace std". I do not understand it. Could...
4
by: PKH | last post by:
This is a part of an autopointer template i'm using. I originally had a Get() member that returned the pointer, but thought it would nice to be able to use the -> operator. The question is why...
16
by: Mars | last post by:
I am reading the code of a program from the examples, but really don't understand this one........ int i,j; ..................................................... while (scanf("%d",&i),j) {...
5
by: R. Kaushik | last post by:
I am posting the code snippet here. It seems to me that the ?: Operator is not behaving properly. It seems like it is a bug: TimeSpan ts1, ts2; float dayHours = 0; ts1 =...
17
by: Hazz | last post by:
In this sample code of ownerdraw drawmode, why does the '(ComboBox) sender' line of code need to be there in this event handler? Isn't cboFont passed via the managed heap, not the stack, into this...
10
by: utab | last post by:
Dear all, So passing and returning a class object is the time when to include the definition of the copy constructor into the class definition. But if we don't call by value or return by value, ...
7
by: Mark Odell | last post by:
I'm running two different compilers against some hairy macros and one, gcc, doesn't like my token pasting result so much. It says, " "." and "foo" does not give a valid preprocessing token ". Some...
123
by: plenty900 | last post by:
I was looking over someone's C++ code today and despite having written perfectly readable C++ code myself, the stuff I was looking at was worse than legalese. The people who are guiding the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.