Skip to content

Releases: peshala-prabhapoorna/jlox

jLox v0.1.0

15 Jan 17:38
Compare
Choose a tag to compare
jLox v0.1.0 Pre-release
Pre-release

Release Notes: Language Features Summary

The following is a summary of the core features currently available in the language as defined by its grammar productions:

Program Structure

  • Program Composition: A program consists of multiple declarations, ending with an EOF token.

Declarations

  • Variable Declaration (var): Allows declaring variables with an optional initializer. Example: var x = 10;

Statements

  • Expression Statements: Evaluate an expression followed by a semicolon. Example: x + 1;
  • For Loops (for): Supports initialization, condition, and increment expressions. Example: for (var i = 0; i < 10; i = i + 1) { ... }
  • If Statements (if): Conditional branching with optional else. Example: if (x > 0) { ... } else { ... }
  • Print Statements (print): Outputs the result of an expression. Example: print x;
  • While Loops (while): Repeats execution while a condition is true. Example: while (x > 0) { ... }
  • Block Statements: Groups multiple declarations or statements enclosed in { }. Example: { var x = 10; print x; }

Expressions

  • Assignment: Assigns values to variables. Example: x = 5;
  • Comma Expressions: Supports chaining of expressions using commas. Example: a, b, c;
  • Conditional (? :): Ternary conditional operator for inline decisions. Example: x > 0 ? "positive" : "non-positive";
  • Logical Operations:
    • Logical OR (or). Example: true or false
    • Logical AND (and). Example: true and false
  • Equality Comparisons: == and !=. Example: x == y
  • Comparison Operations: Greater than, less than, and their inclusive counterparts (>, >=, <, <=). Example: x >= y
  • Arithmetic Operations: Addition, subtraction, multiplication, and division (+, -, *, /). Example: x + y * z
  • Unary Operations: Negation (-) and logical NOT (!). Example: -x or !true
  • Grouping: Parentheses for expression grouping. Example: (x + y) * z

Literals and Identifiers

  • Literals: Supports numbers, strings, booleans (true, false), and nil. Example: 42, "Hello", true, nil
  • Identifiers: Variables and names that can be assigned values or used in expressions.

Full Changelog: https://github.com/peshala-prabhapoorna/jlox/commits/v0.1.0

@peshala-prabhapoorna