Tutorial or Book on the implementation of metalanguage in Javascript

I worked in Javascript and PHP, but I think that the most difficult part is not the implementation, but the design of the webapp architecture [as usual.,.] In this direction, I wanted to create a kind of metalanguage that introduces PHP code as input, but it outputs JavaScript code, which makes the design and implementation phase less painful [st is similar to GWT, Google Web Toolkit]. I found writing this interpreter from scratch [parser, lexer,.,.] A viable option, but a long one. Then I came across Process.js [a library created by John Resig], where the user actually writes java-like code, which was then converted to Javascript by Processing.js. I searched the web for tutorials that introduce this powerful Javascript feature, but have not found any! Can someone PLEASE help me with any link, title of the book,where can i get at least an introduction? Thanx for your answer !!!!

+3
source share
3 answers

Honestly, I think process.js is not suitable for what you want, it was created to work with the new canvas element, and not with a web page.

Also, I think (honestly) I think that sucks. They handle processing using Regex, this is completely wrong; you cannot parse a programming language with Regex.

There is a javascript compiler compiler called JS / CC , it is very easy to use, just learn the grammar and you can make a simple programming language.

But if you want to make a complex language (for example, processing or php) yourself, get ready for nightmares.

PS: you need to know Javascript to implement a programming language in Javascript ...

+1

, haXe.

haXe - , () :

  • Javascript
  • PHP
  • ++

-, haXe Javascript, Flash, PHP ++ .

+2

How about creating some PHP functions that generate JavaScript code? I don't think you really need to write an interpreter for a custom language script. Ruby on Rails, for example, to generate some JavaScript with simple Ruby code.

+1
source

Source: https://habr.com/ru/post/1763906/


All Articles