Skip to content

Cornayy/lurk

Repository files navigation

lurk

An interpreter for a fictional language.

About

This interpreter parses Krul source code files (*.txt) and executes the matched expressions. When a file ends, the last value is used as the file name of the file that is yet to be parsed. Execution of the Krul program will stop when an end expression is interpreted. For more information about all the possible expressions, have a look at the following chapter.

This interpreter was originally a university assignment, but I decided to take it a step further and overengineer it.

Configuration

The lurk program is constructed with the following configuration:

interface ISettings {
    useLocalPath: boolean; // Use the local source code files (src/resources).
    sourcePath: string; // Local path (src/resources) or online path.
    expressionPath: string; // The path where expressions are located (src/core/expressions).
    currentSource: string; // The current source code file that is being executed.
}

Expressions

A list of all possible expressions that Lurk supports.

Function

  • End of search - end
  • Function - fun
  • Return - ret

Integer

  • Absolute - abs
  • Add - add
  • Decrement - dec
  • Divide - div
  • Increment - inc
  • Modulo - mod
  • Multiply - mul
  • Negate - neg
  • Subtract - sub

Jump

  • Go to - gto
  • Go to if equal - geq
  • Go to if greater - ggt
  • Go to if greater or equal - gge
  • Go to if less - glt
  • Go to if less or equal - gle
  • Go to if not equal - gne

String

  • Concatenation - cat
  • Duplicate - dup
  • Index - idx
  • Length - len
  • New line - enl
  • Reverse - rev
  • Rotate - rot
  • Substring - slc

Value

  • Assign variable - =
  • Digit - \d
  • Label definition - :
  • Label reference - >
  • Variable reference - $
  • Text - \

License

MIT

About

An interpreter for a fictional language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published