New Dec. 2019: Auto-port to C++
Coral is an ultra-simple language for learning programming. Key features:
- Simplicity: Coral only has constructs needed for basic programming concepts, and each construct is simple. The language prevents common mistakes.
- Code/flowchart unity: Coral has a flowchart version, so teachers can start with flowcharts and lead to code, or with code and visualize with flowcharts.
- Visualizing simulator: A free web-based Coral simulator shows step-by-step execution, variable values, inputs being consumed, and outputs. Students install nothing, they just program and execute.
- Flowchart layout: The simulator generates a flowchart from code, with the flowchart’s top-down and indentation layout matching the code, so learners can visualize code execution via flowcharts.
Many languages attract people to programming, like Alice, Logo, Scratch, and Snap. Some emphasize “computational thinking” so look different from industry coding languages, or don’t have a flowchart view . Coral looks like industry languages (Java, C++, C, Python), but with ultra-simple syntax, plus a visualizing education-focused code and flowchart simulator.
Industry coding languages, like Java, C++, C, and even Python, have syntax and nuances that trip learners. Coral is much simpler.
Some flowchart languages exist, like Raptor, but require installation, don’t run on tablets or smartphones, and lack a matching code language. Coral has a web-based simulator, and unites code and flowcharts.
Coral helps learn key programming concepts — variables, assignments, branches, loops, arrays, and functions. Learners can then write programs to solve problems, like finding the max in a set of numbers, and then easily move to an industry coding language.
Coral is an effort by computer scientists at zyBooks, the Univ. of California at Riverside, and the Univ. of Arizona. Suggestions are welcome. Email: email@example.com
Language design decisions
Below are some language design decisions that focus on easing learning.
- Only 7 constructs, each quite simple
- One statement per line, and no need for semicolons
- 3-space indents for nesting: More readable than arbitrary indents (Python) or braces (C/C++/Java), and less error-prone.
- Only single-line comments
- Only integer / float data types (and string literals for output), enough to learn programming concepts
- One variable per declaration
- All variables declared at top of function
- No global variables
- Get and Put statements are intuitive, like pseudocode: Put x to output
- One item (variable or string literal) per output statement
- Simple branch condition syntax
- Real if-elseif-else construct, not nested if-else’s as in C/C++/Java
- Logical operators are words and, or, not, rather than symbols.
- No assignment in conditions
- Only two loop kinds: while and for
- Simple loop condition syntax
- No increment operator (i++)
- Uses “array” (vs. [ ]) for declaration readability
- Array size accessible via myArray.size, simplifying iterating through array
- Array size set once: In declaration, or before element access — enables dynamic array but limited to minimize mistakes.
- Simple explicit function definition syntax, including having “returns” at end for better readability
Function FeetToCm(float numFeet) returns float numCms
- Uses “returns nothing” for no return value, not less-intuitive “void” or unspecified
- No return statement; upon reaching function’s end, return-variable’s last value is returned
Recurring themes: use simple intuitive syntax, avoid multiple ways of doing same thing; reduce ways for learners to make mistakes, simulator detects many common errors. See our philosophy page for more.
We’ve made the Coral simulator free for students and teachers, and created a tutorial for learning Coral’s constructs. See the menu links at this page’s top.
Learning programming is much more than learning a language’s constructs. We’ve created a zyBook, Fundamental Programming Concepts, to teach programming concepts (input/output, variables/assignments, branches, loops, arrays, functions), using Coral. The zyBook has many examples, integrates the simulator, and has auto-generated/graded homework exercises involving tracing and writing Coral. The zyBook starts with flowcharts and eases into code, so learners visualize code execution (a hard part of learning programming).
Coral is useful for:
- Language-neutral programming intro courses, which may use flowcharts or pseudocode. Coral is as easy as those languages, but runs in our web-based simulator, so learners get feedback — and have more fun. Our simulator is easier and more educational than current tools.
- AP CS Principles, Intro to Computing Technology, and other courses that teach programming for a few weeks. Coral avoids installation and is ultra-friendly, so students can be writing and executing programs in just minutes.
- CS 1 courses, where instructors might start with Coral, and transition to an industry language. Such a “spiral” approach can help learners master concepts, and later learn industry language syntax. Or, instructors can use the simulator in class to visualize step-by-step execution, variable updates, and more.
- Summer prep, to give incoming freshmen a super-easy way to self-learn programming concepts, hitting your CS 1 course running.
- Independent learners, who want know what programming is about, or want an easy path to learning an industry language.
Feedback / Mailing list
We love feedback — email firstname.lastname@example.org, or use the feedback form at the bottom of this page.