Giter Site home page Giter Site logo

chrisblutz / trinity-legacy Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 626 KB

The legacy version of the Trinity Programming Language [archived]

License: Apache License 2.0

Java 99.84% Shell 0.09% Batchfile 0.07%
object-oriented programming-language trinity

trinity-legacy's Introduction

Trinity Logo

This is the legacy version of the Trinity interpreter. The new, updated version can be found here.


Trinity is a dynamically-typed, object-oriented programming language. It is heavily influenced by aspects of Java and Ruby.

Repository Structure

  • bin - Batch/Shell scripts
  • lib - Trinity standard library
  • logo - PNG/SVG logos for Trinity
  • src - Java source code for the Trinity interpreter
  • test - Trinity unit tests (written in Trinity)

Copyright

Copyright © 2017 Christopher Lutz. See LICENSE for further details.

trinity-legacy's People

Contributors

chrisblutz avatar

Stargazers

 avatar

Watchers

 avatar  avatar

trinity-legacy's Issues

Array.removeObject does not remove objects as expected

Array.removeObject should be made to operate similar to Map's methods, where the equality of values is checked using Trinity's == method rather than Java's checker. This method might even be de-nativized to provide the best solution:

def removeObject(value)
    for i = 0; i < length(); i += 1
        if this[i] == value
            remove(i)
            i -= 1

ExpressionInterpreter falsely report items inside block definitions |x| as being "on the first level"

Take the following code sample:

method() |i = 2 + 2|
    ...

In this sample, the + inside the block definition (vertical bars), is reported as being "on the first level", and is used as a division point when parsing. In the eyes of the parser, the parts of the statement look like this: method() |i = 2, +, and 2|.

The expected functionality would be to treat these definitions as a separate entity, excluded from any parsing on the first pass. If this was the case, the example would be treated as a single method call with an attached block. Only when the arguments for that block are parsed would the + be used to split statements.

Scope not saved on reflective method invocation

Take the following sample:

module TestModule
    class Test
        def static main(args)
            Test.class.getMethod('main').invoke(nil, [])

This should start an infinite recursion loop. However, it throws this error:

Trinity.Errors.MethodNotFoundError: No method 'Test' found in 'Method'.
  at TestModule.Test.main in file 'test.ty' at line 4
  at Method.invoke (native)
  at Class.getMethod (native)
  at TestModule.Test.main in file 'test.ty' at line 4
  at native method '<init>'

When the method is called the second time, its scope is different and no longer contains the correct information. This may require a move from Procedure.call to Class.tyInvoke.

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.