Coder Social home page Coder Social logo

pox's Introduction

pox

lox programming language ast-walking interpreter

Note: some differences compared to the original implementation of lox

  • strings can be denoted with single quotes
  • /* multi-line comments (nesting them is not supported) */
  • escape sequences supported by python are supported on pox as well
  • truthiness is implemented with python's bool function (truth testing procedure)
  • fn instead of fun
  • let instead of var
  • pox has support for else-if (see the examples folder)
  • the print statement doesn't exist

built-in classes:

  • list this is a really thin wrapper around python's list type, see the source code for methods it has

built-in functions:

  • print(value) prints the given value to stdout without a trailing new line
  • println(value) prints the given value to stdout with a trailing new line
  • input(prompt) python's input function, returns nil on EOFError
  • chr(int), ord(char) python's chr and ord functions, they both return nil on TypeError
  • str(object), int(string), float(string) python's str, int and float functions. int and float returns nil on ValueError
  • strlen(string) returns the length of a given string, nil if the passed argument is not a string
  • strn(string, n) returns the nth char of a given string, nil if n > len(string) or if string is not a string
  • exit(value) calls sys.exit with the given value
  • time() returns the time in seconds since the epoch as a floating point number
  • sleep(secs) suspend execution of the program for the given number of seconds
  • pow(a, b) returns a**b

pox's People

Contributors

brkp avatar

Stargazers

Artin Mohammadi avatar Burzum avatar xyz2k8 avatar

Watchers

xyz2k8 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.