All Projects → pumascript → puma

pumascript / puma

Licence: MIT license
Meta-programming framework for JavaScript based on LayerD concepts

Programming Languages

javascript
184084 projects - #8 most used programming language
TeX
3793 projects
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to puma

inteligenciafrvm
Repo oficial de la cátedra IA, 5to Ingeniería en Sistemas de Información, UTN FRVM - Argentina
Stars: ✭ 12 (-60%)
Mutual labels:  utn, argentina
ocean
Programming language that compiles into a x86 ELF executable.
Stars: ✭ 164 (+446.67%)
Mutual labels:  ast
human-parser-generator
A straightforward recursive descent Parser Generator with a focus on "human" code generation and ease of use.
Stars: ✭ 27 (-10%)
Mutual labels:  ast
performance-decorator
🏇User behavior & Function execution tracking solution - 大型前端项目的用户行为跟踪,函数调用链分析,断点调试共享化和复用化实践
Stars: ✭ 39 (+30%)
Mutual labels:  ast
ast-grep
🔍 Like grep, but more powerful than you can possibly imagine
Stars: ✭ 14 (-53.33%)
Mutual labels:  ast
astravel
👟 Tiny and fast ESTree-compliant AST walker and modifier.
Stars: ✭ 38 (+26.67%)
Mutual labels:  ast
ctxexp-parser
In the dynamic execution of JS language environment (wechat applet) to execute JS class calling function.
Stars: ✭ 17 (-43.33%)
Mutual labels:  ast
gradle2kts
Gradle Groovy to Gradle Kotlin conversion tool - discontinued spike
Stars: ✭ 34 (+13.33%)
Mutual labels:  ast
retidy
Extract, unminify, and beautify ("retidy") each file from a webpack/parcel bundle (JavaScript reverse engineering)
Stars: ✭ 27 (-10%)
Mutual labels:  ast
rector-nette
Rector upgrades rules for Nette
Stars: ✭ 16 (-46.67%)
Mutual labels:  ast
kataw
An 100% spec compliant ES2022 JavaScript toolchain
Stars: ✭ 303 (+910%)
Mutual labels:  ast
konan
find all require/import calls by walking the AST
Stars: ✭ 48 (+60%)
Mutual labels:  ast
omakase
Java-based, plugin-oriented CSS3+ parser
Stars: ✭ 13 (-56.67%)
Mutual labels:  ast
about-Vue
📔 Vue 源码的探讨和学习
Stars: ✭ 56 (+86.67%)
Mutual labels:  ast
rector-cakephp
Rector upgrades rules for CakePHP
Stars: ✭ 18 (-40%)
Mutual labels:  ast
CastXMLSuperbuild
Build CastXML and its dependencies (LLVM/Clang)
Stars: ✭ 32 (+6.67%)
Mutual labels:  ast
ninny-json
JSON typeclasses that know the difference between null and absent fields
Stars: ✭ 19 (-36.67%)
Mutual labels:  ast
astutils
Bare essentials for building abstract syntax trees, and skeleton classes for PLY lexers and parsers.
Stars: ✭ 13 (-56.67%)
Mutual labels:  ast
redot
Graphviz dot file processor powered by plugins based on @unifiedjs
Stars: ✭ 60 (+100%)
Mutual labels:  ast
georef-ar-api
API del Servicio de Normalización de Datos Geográficos de Argentina.
Stars: ✭ 102 (+240%)
Mutual labels:  argentina

PumaScript Build Status Join the chat at https://gitter.im/emravera/puma

PumaScript is a research programming language that adds meta-programming capabilities to JavaScript and is develop at the Universidad Tecnologica Nacional (UTN-FRC) in Cordoba, Argentina.

It has exactly the same syntax and semantic than regular JavaScript plus meta-programming capabilities such as introspection and re-writing features.

A number of PumaScript features are based on LayerD project. Which is a meta-programming framework for statically typed languages.

Getting started with Puma

npm install -g grunt grunt-cli

In order to set-up PumaScript environment to give a try follow these steps:

git clone https://github.com/pumascript/puma.git
npm install
grunt init

After these steps PumaScript editor is ready to start coding. Open in your browser puma's editor:

editor/puma-editor.html

The editor shows two frames side by side. The one in the left allows writing code in PumaScript language and the one in the right is used to see the results of re-writing after pressing the button "Execute".

Now is time to write the Simple PumaScript program!

Simple PumaScript Program

Any JavaScript program is a PumaScript program. Write the following snippet in the PumaScript section of the editor:

    /** @meta */
    function sum(a, b)
    {
        return pumaAst( $a +  $b);
    }
    sum(5, 6);

The sample declares the meta-function "sum" that takes two arguments. These arguments are not values but AST (Abstract Syntax Tree) of the actual arguments.

The return expression use the special function "pumaAst" to build a new AST and replace the identifiers "$a" and "$b" with the AST of the actual arguments. In the sample, "sum" is called with literals "5" and "6".

So, the expression "sum(5, 6)" will be re-written in the JavaScript panel as:

5 + 6

A more useful example of usage:

This example show how to use PumaScript metafunctions to re-write JQuery selectors into native JavaScript functions:

/* @meta */
function $(a){
    return pumaAst( jQuery(document.getElementById($a)) );
}

Will re-write:

$("#some-panel");

Into this line:

jQuery(document.getElementById('#some-panel'));

A meta-function can avoid re-writing the caller expression by returning null instead of the AST.

If you wish want more examples, you could go to PumaScript wiki.

Using PumaScript with require

PumaScript was developed as a AMD module so it can be used with any JavaScript module loader. In order to use in your project copy the src folder to your project.

To include the functionality using requireJS into your code add the following:

<script data-main="/src/pumascript.js" src="require.js"></script>

Now you can use PumaScript in your code in this way:

    var puma = require('pumascript');
    puma.evalPuma('<PUMA PROGRAM STRING HERE>');

Bugs Report

Feel free to create an issue onto Github issues tracker and add the right label. Also you can get in touch and we will do that for you.

Would do you like contribute?

We have ton of work that need to be claimed. From coding to documentation. Don't hesitate to contact. We'll waiting for you.

License

MIT. Details on LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].