Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

Dynamic-Interpreter

The start of an interpreter

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

Express

Currently this is a simple and experimental core of a scripting language.

The language design is mostly inspired by Python, JavaScript and some inspiration from Object Pascal.

Test me

  1. open cmd.exe in the same folder as main.exe
  2. run: main.exe path/to/file.xpr

Alternative last startup-argument: A number to set max length of printed bytecode.

So far we have

  • [x] Operations:
    • [x] := += -= *= /= `&= |= ^=`
    • [x] = != < > <= >=
    • [x] + - * `**` / | & ^ `shr shl`
    • [x] and or xor
  • [x] Constructs: if..else for while repeat print
  • [x] Branch statements: continue break return
  • [x] Data types: int float bool list string char ... and the "lack" of a datatype: None
  • [x] Script functions (the basics)
  • [x] Methods supports local declarations, tho currently no closures (will error)
  • [x] Special expressions: x if condition else y, more could be added.
  • [x] Garbage collector - which might, or might not work properly...

Could be more stuff that I've failed to mention. But keep in mind that many feature added is probably iffy, and a lot of error handling is lacking..