Git Product home page Git Product logo

walrus's Introduction

Walrus programming language

Walrus is an implementation and extension of the Lox language as featured in the Crafting Interpreters book. It is coded with IntelliJ IDEA and built using Gradle. The version of Java used is 16 (latest at the time), but newer versions *might work.

It features a custom handwritten lexer based on a customized StringCharacterIterator class. The parser is a modified Lox parser that is based on Recursive Descent parsing. Modifications include using Java collections for iterating through the list of tokens and additional functionalities such as unary operators. The interpreter is also based on a modified Lox interpreter with added arrays and a small standard library (and small additions such as string concatenation).

Additionally, most of the code should be documented with comments in Javadoc format.

Standard library

Standard library consists of the following functions:

  • clock() -> Returns current time in seconds since 1970
  • exit() -> Safely exits the program
  • println("string") -> Wrapper around java println function
  • input() -> Wrapper around java system input function
  • rand() -> Generates a random float between 0 and 1.
  • abs(x) -> Calculate absolute value of the specified expression
  • pow(x,y) -> Raises x to the power of y
  • sqrt(x) -> Square root of the number
  • round(x) -> Rounds a number
  • string(x) -> Converts an object into string
  • number(x) -> Converts a string into number
  • array(size) -> Creates an array

walrus's People

Contributors

ijandric97 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.