Code Monkey home page Code Monkey logo

toyide's Introduction

ToyIDE logo

Note: This is a fork from here. All changes by Hanns Holger Rutz, released under the same license (GPL v3+). This fork refactors the project into sbt sub-modules, cross-building against Scala 2.11 and 2.12, applies some code style changes, and investigates the possibility of adding Scala as a supported language (in progress). To run the demo application, use sbt app/run.

Known issues:

  • sbt test fails with several cases, also different between Scala 2.11 and 2.12. This must be either a race condition or dirty global state, because running, for example, sbt 'testOnly com.pavelfatin.toyide.languages.lisp.library.CoreTest' works without problem, although that spec fails when running all tests.

Below is the original README:


ToyIDE is an imitation of a full-featured IDE plus toy languages (imperative, functional) with complete IDE support, interpreters and compilers. All the parts were built from scratch in Scala, without relying on any existing code or libraries.

The project is purely educational. It is a product of a long vacation in the country and a desire to learn how all this stuff really works.

Although I applied evolutionary design in the development (to uncover the reasons behind architecture), it turns out that many techniques in the code come close to commonly used patterns. I learned a lot from the project and hope it might be useful to the people who want to know more about lexers, parsers, AST, Java bytecode and other similar fun, but tricky things.

Update: Jason Zaugg endorsed the project as "open-source Scala application with simplicity and taste"

ToyIDE: Main window

Source code is 100% Scala. There are ~800 unit tests (run in < 3 seconds).

Download binaries: toyide-1.2.4-bin.zip (7.5 MB)

Features

Imperative language

Imperative, statically-typed, C-like language:

  • common data types & operators,
  • comprehensive static analysis,
  • data & control flow inspections,
  • error reporting & stack traces,
  • expression optimization,
  • JVM bytecode emitter.

Project Euler code examples:

ToyIDE: Imperative Language

Functional language

Functional, dynamically-typed, Clojure-like language:

  • macros, variadic functions,
  • quasi-quotations, anonymous function literals,
  • unique symbol name generation,
  • structural binding,
  • tail call optimization,
  • error reporting & stack traces,
  • comprehensive standard library,

Minimalistic web server code as an example:

ToyIDE: Functional Language

Syntax highlighting

Expressive syntax and error highlighting, code inspections, customizable schemes:

ToyIDE: Highlighting ToyIDE: Coloring

Advanced editor

Editor with selection, copy/paste, undo/redo, braces balancing, auto-indentation:

ToyIDE: Edit Menu ToyIDE: Code Menu

Split editing

Editor can be split horizontally, so that viewports, cursors and selections are separate, while text is common:

ToyIDE: Split Editing

Brace matching

Brace pairs are highlighted, complement braces are added / removed automatically:

ToyIDE: Brace Matching

Show usages

Highlighting of declaration identifier and all related references:

ToyIDE: Show Usages

Autocomplete

Automatic completion of identifiers and keywords:

ToyIDE: Autocomplete

Code formatting

Automatic formatting of arbitrary code blocks (spacing, indentation, line breaks):

ToyIDE: Code Formatting (before)

ToyIDE: Code Formatting (after)

Rename refactoring

For languages that rely on built-in concept of references, renaming works out-of-the-box:

ToyIDE: Rename Refactoring (before)

ToyIDE: Rename Refactoring (after)

Control / data flow analysis

Code is checked for unused declarations and unreachable statements:

ToyIDE: Control Flow Analysis

Static code optimization

Code expressions are automatically analyzed for possible simplifications:

ToyIDE: Code Optimization

Structure pane

Internal code representation is reflected in a structure pane (with synchronous highlighting):

ToyIDE: Structure Pane

Interpreter

Programs can be run by interpreter, without previously compiling them into bytecode:

ToyIDE: Interpreter

Compiler

Programs can also be compiled and run as JVM bytecode:

ToyIDE: Compiler

Class export

The bytecode can be exported as JVM .class files:

ToyIDE: Class Export


Pavel Fatin, https://pavelfatin.com

toyide's People

Contributors

pavelfatin avatar sciss 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.