Code Monkey home page Code Monkey logo

agate's Introduction

Agate

Agate, a simple and embeddable programming language

Agate is a scripting language with a simple yet powerful object-oriented syntax written in C99. It can easily be embedded in any application (e.g. games) with only three files to copy in your source tree. It has decent performance thanks to a bytecode virtual machine and a single pass compiler.

Hello World!

IO.println("Hello World!") #> Hello World!

# a comment

def fib(n) {
  if (n < 2) {
    return n
  }
  return fib(n - 1) + fib(n - 2)
}

IO.println("fib(28) = %(fib(28))") #> fib(28) = 317811

class Vec2 {
  construct new(x, y) {
    @x = x
    @y = y
  }
  x { @x }
  y { @y }
  +(other) { Vec2.new(@x + other.x, @y + other.y) }
  to_s { "(%(@x),%(@y))" }
}

def vec(x, y) { Vec2.new(x, y) }

def a = vec(1, 2)
def b = vec(3, 4)
IO.println("%(a + b)") #> (4,6)

Acknowledgements

Agate is largely inspired by the great work of Bob Nystrom, especially his awesome book Crafting Interpreters and his classy little scripting language Wren.

agate's People

Contributors

jube avatar

Stargazers

Jeffrey H. Johnson avatar Aos Enkimaru - aka - Angelo Schneider avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

agate's Issues

instance fields have getters by default

agate/examples/logo.agate

Lines 166 to 168 in 9a2f4fc

x { @x }
y { @y }
z { @z }

Making instance fields have these style of getters by default would eliminate these kinds of lines.

To allow the getters to not automatically be added you could define some sort of naming rule for "private" fields -- Python uses __name.

does this sound like a good idea?

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.