Page MenuHomePhabricator

Language Design and Syntax
Updated 748 Days AgoPublic

Language Structure | Operators | Data Types | Variables | Functions | Statements | Errors

Functional | Classes | Tests | Mutability

Vision

The design of Ratscript's syntax has three goals:

  • Explicit: Make behavior obvious from the syntax.
  • Simple: Lower the learning curve for beginning users.
  • Elegant: Maintain usability by experienced programmers.

Glossary

  • compound statement: a statement made up of one or more *clauses*. For example, an if statement.
  • clause; a single header-suite pair in a compound statement, such as the else clause in an if/else compound statement
  • expression: a unit of code that can be evaluated to a value.
  • header: the top part of a clause, usually defining how and when the clause will be executed.
  • name: a textual reference to a value in memory, in the context of a variable. Names have both scope and type, and are bound to a value.
  • statement: a single, executable unit of code.
  • suite: the body part of a clause, subordinated to a header.
  • value: any object or piece of data in memory, which can be bound to one or more *names*. Values have type, but no scope.
  • variable: a value in memory associated with a name.
NOTE: In Python, names have scope, but no type; values have type, but no scope. In Ratscript, names have both scope and type, while values only have scope. Ratscript names can be "rebound" to a new value, as long as that value is the same type. (We should debate whether this is a good idea, but I [Jason] believe it will avoid some issues Python has.

Document Conventions

Notes, TODOs, and proposed statements are formatted like this (blue block) to make them easier to find.
Design Principles: These are notes about design principles.
# This is a valid code example.
# This is an invalid or bad code example ("counterexample").
Last Author
emlarson
Last Edited
Jul 22 2020, 1:34 PM

Event Timeline

jcmcdonald edited the content of this document. (Show Details)
jcmcdonald changed the edit policy from "All Users" to "Ratscript [Project] (Project)".
bdlovy published a new version of this document.May 27 2020, 3:54 PM
jcmcdonald edited the content of this document. (Show Details)
jcmcdonald changed the title from Syntax to Language Design and Syntax.Jul 20 2020, 12:18 PM
jcmcdonald edited the content of this document. (Show Details)