Skip to content

Instantly share code, notes, and snippets.

@rohit-nsit08
Created March 27, 2011 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohit-nsit08/888952 to your computer and use it in GitHub Desktop.
Save rohit-nsit08/888952 to your computer and use it in GitHub Desktop.
project: javascript on parrot
Name: Rohit Jangid
Email id: rohit.nsit08@gmail.com
Google id: rohit.nsit08
Other contact info:
Irc nick-name on #parrot channel: rohit_nsit08
Project title: JavaScript on Parrot
Abstract:
The project is based on implementing a JavaScript compiler to be written mostly or entirely using JavaScript.
The existing compiler projects like (jasper/cafe) are most likely to be used for base development. Reusing
already built code will be of utmost priority, which requires use of parser generators like Jison or PEG.js etc;
the primary attempt is to customize the backend (code generator) of cafe to make it generate parrot friendly PIR/PBC code. Cafe project is most likely to provide much needed compiler infrastructure.
Benefits to the Parrot VM and Open Source Community:
JavaScript is one of the most popular and preferred scripting language among users and hackers
on the internet, all such people will benefit with its inclusion in parrot list of interpretors.
It is important since all the present browsers have JavaScripting capabilities
but there are very few command line tools available for it.
There are compilers already available in javascript like
'Rhino', which is written in java and is one of the sought after tool in this regard, but has limitations
with size of byte code generated by it (which I faced myself). Currently narwhal is using 'rhino'
'node.js',another compiler, which uses much better Google’s v8 engine and is built in C++.
But there are no such compilers in JavaScript.
Though there exists a JavaScript compiler on parrot "ECMASCRIPT", but is not very usable in its
current form due to lack of people working on it and its dependencies on old NPQ and PGE.
In short, there is a need for a better, fast, optimized command-line JavaScript compiler with better features.
So we can offer this service on parrot, which will contribute to the Open-Source Community also.
Since good tools are already available in JavaScript like parser generators and interpreters,
bootstrapped compiler becomes a very good option to start with.
So, here is my proposal on how we can proceed and develop a bootstrapped JavaScript compiler written entirely in JavaScript.
Deliverables:
A basic JavaScript compiler, with tests and a suitable build infrastructure compatible with major systems and a project documentation that will help future developers to carry on work further.
Providing a good build infrastructure and documentation will be highly important for building a community and popularize project after the end of summer.
Project Details:
• The project is based on bootstrapping,
• Will use already available compiler/interpreter which will be used to generate stage 0 compiler.
• Stage 0 compiler will be used to compile and build stage 1 compiler in JavaScript.
• Stage 1 compiler will be modified and stage 2 Compiler will be generated using stage 1 compiler by compiling itself.
• The cycles of improvements will carry on from stage 1 to stage 2 , until a fully working compiler is made
• Possible targets for stage 0 compiler ( narwhal using rhino as its engine, and nodejs using v8 )
• Stage 1 compiler to be built on already available 'cafe' compiler with modified backend to generate PIR code and Jison parser library will be used to generate parser (It is already available in 'cafe')
• Testing is to be included wherever it is possible and needed.
I’m currently experimenting on node.js, Jison, cafe combination and in touch with author of cafe Jison and node.js to sort out the compatibility issues which i am facing right now.
Project Schedule:
Stage 0, stage 1 will be the initial milestones, after that improvement cycles and testing will be performed to improve previous compiler
I’ve tried to integrate my project schedule with gsoc’s timeline
March 28(application period start) – April 8(application deadline):
• Discuss idea with mentors and submit project application, Study codebase of café. Discuss further improvements and changes
Interim Period: till April 25:
Finalize main idea with mentor and a basic layout of the work, study tools required, get familiarize with
git and use of parrot system, Learn PIR during this time
From April 25 onwards and before mid term evaluation
Start hacking on café Backend integration of PIR code generation,
will attempt to replace Original AST by parrot’s PAST if first one fails by any reason
Build stage 1 compiler and stage 2 compiler Before Mid-term evaluations deadline to have enough time for implementing features
last month
attemp to wind up anything missing from previous stages, work on improvement in project will the focus
References and Likely Mentors:
Discussed project idea with
Whiteknight
Dukeleto
Moritz
Lucian
<problem resolution>
will attempt to clear the idea and design of project in best possible detail to avoid problems later
i'm in contact with all the authors whose tools will be used.
<backup plan>
will spend more time on planning before attempting to code to avoid sudden failure
project will be done in multiple stages (i have thought of modular programming) with tests at each stage so that , in case of failure , project can be taken forward from previous level.
Bio
Hello,
My name is Rohit Jangid, and I’m a computer science student (6th semester) from NSIT college, India.
I’ve been programming from my school time and have a wide experience in various types of languages and platform , C/C++ , JavaScript and Java are my primary languages, have also worked extensively in j2ee technology like Servlets and jsp for web-applications.
I’m open source promoter and infact love working on Linux.
I’m very dedicated towards my work and can learn things quickly and I believe that makes me a good candidate to work on this project.
I’m new to parrot but now I’m reading and experimenting on it.
Our semester course for next semester contains “compiler design” as a subject also, This is also one of the motivating factor that attracts me to my project.
I’m familiar with basic project development on Linux and version control system like bazaar and launchpad, recently started using github for parrot.
I’m pursuing a graduate course and currently in 3rd year , and I believe that makes me an eligible student for gsoc , I’ll clarify the legal requirements if needed
@Whiteknight
Copy link

For the timeline, try to give milestones for each week. There are 12 weeks n GSoC, so add 12 entries (or more) to show where you expect to be at each week.

Also, make sure to include information about documentation and testing in your timeline. You can explicitly say how many tests you want to have at each week, or you can mention that a feature is only "complete" if it's tested and documented.

@Whiteknight
Copy link

PAST are parrot objects, and require the compiler to be running on Parrot in order to make them. You will need to have a working code generator first, run your stage 1 compiler on Parrot, and use that to create a new compiler to create PAST (stage-2). This adds a big step to the project and will require a lot of effort to do correctly. If your stage 1 compiler is not going well, you should focus on stage-1 and do it correctly instead of moving on to a bigger project. Can you give a deadline for when you will decide whether to move on to a stage-2 compiler with PAST? Tell us what the deadline for making the decision is, and what your criteria will be for deciding.

What will be your target language? Will you be outputting PIR, or will you output something higher like Winxed or NQP? Can you explain this decision? Winxed has similarities to JavaScript, so outputting Winxed from your code generator may be easier, but will have performance considerations. If you choose to target winxed for stage 1, you might want to be a little bit more aggressive about pursuing a PAST backend for stage-2. PIR code would be faster to run directly instead of Winxed, but may take longer to write and debug.

At what point in the timeline will you prepare a build infrastructure? At what point will you start setting up unit tests. These things take time to do, but can help make other tasks go faster. Include more details about these things in your timeline. What do you intend to use for your build infrastructure? Parrot provides distutils which is easy to use. Make is a common GNU utility which is very common. Are there other tools which might be more focused on JavaScript?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment