Skip to content

DrDynamic/plox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Max Weber
Nov 5, 2024
8f4b1e9 · Nov 5, 2024

History

78 Commits
Nov 5, 2024
Oct 22, 2024
Nov 5, 2024
Oct 22, 2024
Nov 5, 2024
Dec 27, 2023
Jan 4, 2024
Nov 4, 2024
Oct 22, 2024
Oct 23, 2024
Oct 23, 2024
Jan 29, 2024
Nov 4, 2024
Oct 23, 2024
Jan 4, 2024
Jan 29, 2024
Jan 29, 2024
Jan 29, 2024
Oct 31, 2024

Repository files navigation

Features

  • Arithmetic
  • C-Style Single- and multiline comments ( // comment / /* comment */)
  • C-Style Comma operator var i = (a, b, c) // i == c
  • Ternary (X ? Y : Z)
  • Comparison (wich '<'|'<='|'>'|'>=' operators) of mixed types (number, string, boolean)
    • if a string is compared to a number, the string is converted to its length
    • If a number is compared to a boolean, the boolean is converted into a number (true == 1.0 / false == 0.0)
  • optional semicolons
  • REPL
  • If condition
  • Scope and Block
  • Logical operators AND, OR
  • Native Functions
  • While loop
  • For Loop
  • Break and Continue keyword for loops
  • functions have access to parent scope
  • Classes
  • Single Inheritance like Java
  • Methods
  • Functions
  • Local functions
  • super, this keywords for oop
  • public / private class properties
  • static class properties

TBD (ideas)

  • inheritance of fields

  • Traits

  • instaceof mechanic (native method or binary operator?)

  • protected class properties

  • interfaces

  • abstract classes

  • Logical operator XOR

  • import native modules

  • Array data structure with dynamic types

  • Foreach loops

  • Function Extension

  • Elvis (X ?? Y) Operators

  • spread operator (ellipsis)

  • Do While Loop

  • Repeat block like Kotlin

  • Bitwise operators <<, >>, >>>

  • Function can take other Function as Parameter

  • Runtime error

  • Semantic analysis

  • Arity Similar to Python that throw error if developer pass less or more than function arguments

  • Create custom prefix operators

  • Create custom infix Operators

  • undeclare (delete) variables

  • implicit variable declaration?

  • ++ operator to increment a variable

  • +=, -=, *=, /= operators to run calculations on a variable

  • casting strings to callable

  • function declaration without block statement (instant return - like lambda)

  • Compiler instructions (inline / spread loop)

About

A Lox interpreter written in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages