Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Syntax errors on calculators  





2 See also  





3 References  














Syntax error






العربية
Dansk
Deutsch
Español
فارسی

Íslenska
Italiano
Қазақша
Bahasa Melayu
Polski
Русский
Svenska

Українська
Tiếng Vit

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Incomputer science, a syntax error is an error in the syntax of a sequence of characters that is intended to be written in a particular programming language.

For compiled languages, syntax errors are detected at compile-time. A program will not compile until all syntax errors are corrected. For interpreted languages, however, a syntax error may be detected during program execution, and an interpreter's error messages might not differentiate syntax errors from errors of other kinds.

There is some disagreement as to just what errors are "syntax errors". For example, some would say that the use of an uninitialized variable's value in Java code is a syntax error, but many others would disagree[1][2] and would classify this as a (static) semantic error.

In 8-bit home computers that used BASIC interpreter as their primary user interface, the SYNTAX ERROR error message became somewhat notorious, as this was the response to any command or user input the interpreter could not parse. A syntax error can occur or take place, when an invalid equation is being typed on a calculator. This can be caused, for instance, by opening brackets without closing them, or less commonly, entering several decimal points in one number.

InJava the following is a syntactically correct statement:

System.out.println("Hello World");

while the following is not:

System.out.println(Hello World);

The second example would theoretically print the variable Hello World instead of the words "Hello World". However, a variable in Java cannot have a space in between, so the syntactically correct line would be System.out.println(Hello_World).

A compiler will flag a syntax error when given source code that does not meet the requirements of the language's grammar.

Type errors (such as an attempt to apply the ++ increment operator to a boolean variable in Java) and undeclared variable errors are sometimes considered to be syntax errors when they are detected at compile-time. However, it is common to classify such errors as (static) semantic errors instead.[2][3][4]

Syntax errors on calculators[edit]

Syntax error in a scientific calculator

A syntax error is one of several types of errors on calculators (most commonly found on scientific calculators and graphing calculators), representing that the equation that has been input has incorrect syntax of numbers, operations and so on. It can result in various ways, including but not limited to:

See also[edit]

References[edit]

  • ^ Aho, Alfred V.; Monica S. Lam; Ravi Sethi; Jeffrey D. Ullman (2007). Compilers: Principles, Techniques, and Tools (2nd ed.). Addison Wesley. ISBN 978-0-321-48681-3. Section 4.1.3: Syntax Error Handling, pp.194–195.
  • ^ Louden, Kenneth C. (1997). Compiler Construction: Principles and Practice. Brooks/Cole. ISBN 981-243-694-4. Exercise 1.3, pp.27–28.

  • t
  • e

  • Retrieved from "https://en.wikipedia.org/w/index.php?title=Syntax_error&oldid=1220361896"

    Categories: 
    Programming language syntax
    Computer errors
    Parsing
    Programming language theory
    Computer programming stubs
    Hidden categories: 
    Articles with short description
    Short description is different from Wikidata
    All stub articles
     



    This page was last edited on 23 April 2024, at 09:27 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki