Git Product home page Git Product logo

interpreter's Introduction

Important: This project is no longer maintained. The code is still available, but please don't regard it as anything but a hack. Please do not open new support tickets.

Interpreter Build Status Gitter chat

This is an example project implementing a Node.JS interpreter as an iOS app, utilising the Nodelike framework.

Nodelike is a project to implement a roughly Node.JS-compatible interface using JavaScriptCore.framework on iOS 7 and OS X Mavericks.

(JavaScriptCore hasn't been available before iOS 7, and on OS X the project makes extensive use of the newly-updated 10.9-only Objective-C API. Previously on 10.8 there existed only a very low-level and very verbose C API.)

This is currently in a very incomplete state. It could, however, become usable over the following weeks.

demo time

The goals

  • to be drop-in compatible with the current nodejs master
  • to be very lightweight
  • to reuse javascript code from node (/lib)
  • to provide the most minimal binding that is possible (via libuv)
  • NOT to achieve Node.js performance (this is meant as a client-side, not a server-side application)
  • NOT to be backwards-compatible (nodejs cutting edge and newest iOS/OS X required)

What's working right now

  • console.log()
  • process: .argv, .env, .exit(), .nextTick()
  • require() for native modules
  • fs
  • net
  • http
  • timers
  • util
  • url
  • events
  • path
  • stream
  • querystring
  • punycode
  • assert

How to compile

  1. You need to have CocoaPods installed. If you do not have already, run sudo gem install cocoapods.
  2. Install the dependencies via pod install.
  3. Open Interpreter.xcworkspace in Xcode and run!

How to use the app

You can enter Javascript code into the TextView and execute that via a tap on the Execute button. After each execution, when the result of the executed script is not undefined, a popover will appear containing that result.

Have fun!

interpreter's People

Contributors

andreyvit avatar igorklopov avatar kimar avatar ryan-mars avatar srijs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

interpreter's Issues

Require does not work

Basic operations like 1 + 2 work, but when I try the example from the screenshot, I get the following error:

2013-12-14 10:53:19.340 Interpreter[50790:70b] Error: Cannot find module 'fs'

Also: How is the included test file "index.js" executed?

'require' doesn't work on device but works on simulator

While running on the device (I am using an iPhone 5), if you call require, you get EXC: Error: No such native module events; line: 1087, stack: require. For some reason it doesn't read require. However, when you run it on a simulator it seems to work just fine.

For example, if I run:
require('http').createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.end("hello\n");}).listen(8000);

This works fine on the simulator, but not on a real iOS device.

side note: I've also noticed that when you request localhost:8000, with this code, you get TypeError: 'undefined' is not an object (evaluating 'tty_wrap.guessHandleType') stack: createWritableStdioStream when the page is requested.

instructions cleanup

it appears that git version 1.8.3.4 (Apple Git-47) does not perform a recursive submodule init, so the update does not force node to be downloaded.

These steps worked for me:

$ git clone https://github.com/node-app/Interpreter
$ cd Interpreter/
$ git submodule update
$ git submodule foreach git submodule init
$ git submodule update --recursive

Cannot touch scroll if codes lines are longer past the on-screen keyboard

hello,

set-up

iPad Air 128 GB, iOS 7.1.1, Node App 1.2.0.

Expected Behavior

Write or paste code onto the screen for Node App with iPad in landscape mode. Code needs to be longer than 16 lines (try 20 or more). You should be able to use finger then to try and scroll down to see the rest of your code past screen keyboard.

Issue

With more than 16 lines in landscape mode, you cannot touch scroll down and see the rest of your code past the screen keyboard. you could dismiss the screen keyboard (lower right key on screen keyboard), but then you can't keep typing to add or edit code. same is true past however many lines in portrait mode.

This should be fixed so you can touch scroll when your code lines extend down beyond where the on-screen keyboard is.

best,

— faddah wolf
portland, oregon, u.s.a.
github.com/faddah

Node modules (non-native)

What would be the advised way to use node modules, especially with nested node_module structures?

node app Docs section, choosing JSON view doesn't provide way to go back

in the current node app version 1.2.0 running on my new iPad Air 128 GB WiFi only running iOS 7.1.1, if you go to the Docs section of the app, one of the choices under Docs is to view as JSON.

expected behavior —

when going to Docs in node app and choosing to view as JSON, you see the Docs in JSON format, but can also easily go back to the index and other Doc views.

observed issue behavior —

instead, you do see the Docs entries in JSON format, but there is no “back” or “index” or other such links by which you could go back to the regular Docs view, you are stuck in JSON format unless you quit the app and take it out of iOS memory and restart it.

suggested fix behavior —

either take out the JSON view option entirely from the Docs section, or provide links above the JSON view to go back, take you to index or another view, etc.

best,

— faddah wolf
portland, oregon
github.com/faddah

Will this be allowed on the AppStore?

Hi, loving this, but before I get too enthusiastic:
Will (apps using) this be allowed on the AppStore?

A test with:

var fs = require("fs");
fs.readdir("./", function(e,l){ log(l.join(", ")); });

shows

.DS_Store, .DocumentRevisions-V100, .PKInstallSandboxManager, .Spotlight-V100, .Trashes, .dbfseventsd, .file, .fseventsd, .vol, Applications, Library, Network, System, Users, Volumes, as, bin, cores, dev, etc, home, mach_kernel, net, private, sbin, tmp, usr, var  

wich is a bit broader than what I would suspect Apple would allow...

Nodelike.bundle doesn't refresh immediately after changes

I've noticed that when the contents of a module in node_module, are changed, the app doesn't respond to it's changes immediately. I'm assuming that the app is using the previously cached Nodelike.bundle or however the file is being shared across workspaces. So if I change the contents of node_module/examples it won't reflect immediately.

Nodeschool.io!

Is there anyway you can add on nodeschool.io?!?!?

This would be way pass cool ---still not cooler than sonic of course... Nor fast---

Color option

Is it possible to give color option? Or add a night mode? The whiteness can get very stressful on one eyes. A console like night mode if can.

Why Mavericks?

Is there anything here that specifically requires 10.9? Personally, I'd love this to run on 10.8.

Move /lib to Nodelike

The contents of /lib should instead be part of Nodelike, along with the equivalent of src/node.js so that Nodelike is plug-and-play with new apps that want to leverage it.

EXEC - clears screen

Why does pressing the EXEC button clear the screen? I would like it to execute whats typed in thats it. Maybe add some new, edit, clear buttons

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.