Linear syntax: Difference between revisions

Content deleted Content added
SQL: level is a reserved keyword in some languages so the example given would be invalid.
+rcat
 
(6 intermediate revisions by 5 users not shown)
Line 1:
#REDIRECT [[Comparison of programming languages (syntax)#Statements]]
{{unreferenced|date=December 2008}}
 
{{Rcat shell|
'''Linear syntax''' is a [[computer programming|computer-programming]] term for an [[Expression (programming)|expression]] that can be parsed from left to right. Linear syntax implies the ability to write code without the use of [[line feed|line-feed]] or [[carriage return|carriage-return]] characters. Although the use of such characters is recommended for code readability, they are optional, as [[compiler]]s do not rely on them to parse and compile the code. [[HTML]], [[C (programming language)|C]], and [[SQL]] code are examples of languages that employ linear syntax; they all rely on commas, semicolons, and parentheses to separate code blocks.
{{R to related topic}}
 
{{R to section}}
== Example ==
{{R with history}}
=== C ===
{{r wikidata}}
Linear example in C:
}}
<source lang="c">
void main() { printf("Hello world!"); }
</source>
 
Non-linear example in C:
<source lang="c">
void main() {
printf("Hello world!");
</source>
 
=== HTML ===
Linear example in HTML:
<source lang="html5">
<ul><li>Foo</li><li>Bar</li><li>Baz</li></ul>
</source>
 
Non-linear example in HTML:
<source lang="html5">
<ul>
<li>Foo</li>
<li>Bar</li>
<li>Baz</li>
</ul>
</source>
 
=== SQL ===
Linear example in SQL:
<source lang="sql">
SELECT name FROM users WHERE lvl > 10 ORDER BY firstname
</source>
 
Non-linear example in SQL:
<source lang="sql">
SELECT name
FROM users
WHERE lvl > 10
ORDER BY firstname
</source>
 
[[Category:Programming language syntax]]
[[Category:Programming language concepts]]