Editing
Formal Languages
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Understanding</span> == Formal languages are understood through '''Rules''' and '''Nesting'''. '''1. The "Recipe" (Production Rules)''': A grammar is like a "Recipe" for a sentence. * Rule 1: **Sentence** β **Subject** + **Verb**. * Rule 2: **Subject** β "The Cat" | "The Dog". * Rule 3: **Verb** β "Runs" | "Sleeps". * By "Applying" these rules, you can "Generate" thousands of valid sentences ("The Cat Sleeps," "The Dog Runs"). * A "Formal Language" is the "Total Set" of every sentence that can **ever** be made with those rules. '''2. The "Mirror" (Context-Free Languages)''': Regular languages are "Linear" (like a train). Context-free languages are "Symmetric" (like a mirror). * A "Regular" language can handle: **AAAABBBB** (any number of As then any number of Bs). * A "Context-Free" language can handle: **A{n} B{n}** (the number of As **must match** the number of Bs). * To "Match" them, the machine needs a "Stack" (Memory) to "Count" the As as they go in. This is why "HTML tags" <div>...</div> or "Parentheses" ( ( ) ) are Context-Free. '''3. The "Parser" (Understanding Code)''': When you type "print('Hello')", the computer doesn't "Read" it like a human. * It "Parses" it into a **Syntax Tree**. * It checks: "Is 'print' a valid Terminal? Is there a '('? Is there a matching ')'?" * If the "Formal Language Rules" are broken, you get a "Syntax Error." '''The 'Chomsky Hierarchy' Insight'''': Noam Chomsky discovered that "Human Language" is much more complex than "Regular" or "Context-Free." He argued that humans have a "Universal Grammar" (Type 1 or Type 0) hard-wired in their brains, allowing us to "Understand" and "Create" infinite new sentences from birth. This linked "Linguistics" and "Computer Science" forever. </div> <div style="background-color: #8B0000; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information