Can Poor Syntax Hinder Computer Language Use?

In summary, the problem with writing an algorithm in computer language is that the syntax is not very good and it would take a lot longer to execute than it would to write the same algorithm in another language with better syntax.
  • #1
Avichal
295
0
Is it possible that a set of instructions is impossible to be written in computer language because the language's syntax is not very good? So in that case what people do? - create another language which has better syntax?
 
Technology news on Phys.org
  • #2
For some languages, processor specific instructions can be accessed by using extensions made to the language, such as some intrinsic functions for C. For example, Microsoft C has a _popcnt() instrinsic function to utilize the popcnt X86 instruction, which counts the number of 1 bits in a value.

Some super computers add system specific extensions to the Fortran language to take advantage of parallel or vector processing.

Some languages deliberately limit what a programmer can access, such as Python not having assignable pointer variables.

For languages that can be compiled (versus interpreted), usually assembly modules can be linked with high level language modules to get around any limitations of a high level language.
 
  • #3
Avichal said:
Is it possible that a set of instructions is impossible to be written in computer language because the language's syntax is not very good?

No. Not with any computer now in existence, nor with any that is ever likely to be built. Turning proved about 60 years ago that any algorithm that can be written for any computer can be written for any other computer, it just might take a lot longer (or possibly shorter) time to execute.

EDIT: Hm ... I see that my statement didn't actually address your question. Let me rephrase: If you can WRITE an algorithm as a step of logical procedures and you can express it in any computer language on any computer, then you can express it in any other language on any other computer. That still doesn't quite answer your question but it's as close as you're likely to get. I still think in any case the answer is no.
 
  • #4
Hey Avichal and welcome to the forums.

There are some kinds of algorithms that will never ever finish that are written on computational devices with finite-memory and finite-processing time (for each instruction that is).

For example if wanted to calculate pi in its binary form using the arc-tan series formula, then you would never ever complete the calculation (even if you had infinite-memory) using the instruction set of a normal modern PC (arithmetic and so on).

Problems like this can't be changed simply by syntax if the underlying computation is unchanged: if the computation is unchanged, then changing the syntax doesn't change anything.

But if you change the nature of the computation and show that you can do this kind of thing in finite time (and you will end up most likely changing the data structures and what they represent in the process), then this is a different issue.

If you want to look at the formal definition of these kinds of problems look at this:

http://en.wikipedia.org/wiki/Halting_problem
 
  • #5
Sorry if the question was not clear as i received a warning regarding so. Anyways you guys did give me the answers. Thank you
 

FAQ: Can Poor Syntax Hinder Computer Language Use?

What is syntax in computer language?

Syntax in computer language refers to the rules and structure that determine how code is written and interpreted by a computer. It includes the use of keywords, punctuation, and other elements to form valid instructions.

How can poor syntax hinder computer language use?

Poor syntax can make it difficult for a computer to understand and execute code correctly. This can lead to errors and bugs in the program, causing it to not function as intended.

What are some common examples of poor syntax in computer language?

Examples of poor syntax in computer language include missing or incorrect punctuation, using incorrect keywords or variable names, and not following the correct structure for programming statements.

How can one improve their syntax in computer language?

Practicing and studying programming languages can help improve syntax. It is also important to pay attention to details and follow proper coding conventions and guidelines.

Can using a code editor or IDE help with syntax errors?

Yes, code editors and IDEs (Integrated Development Environments) often have features that can help catch and correct syntax errors, such as code highlighting and auto-complete. However, it is still important to have a good understanding of coding syntax to avoid errors.

Back
Top