Journal of Advances in Shell Programming
Advanced OOP and New Syntax Patterns for Javascript
Abstract
We present OBJS, a new transpiler project featuring the implementation of typified variables and functions call management in Javascript, as well as several new operators and syntax patterns that could make coding more agile and versatile. The goal is to empower this language. According to this point of view, this transpiler aims at implementing Object Oriented Programming paradigms into Javascript. The author opines that this would be likely the best evolution of this language in ways that should be proper to the original syntax, that is, by adopting native C++ standards, so that there would be no promiscuity between old and new patterns, benefiting those who come from similar languages.Keywords
References (31)
- Aho VA, Ullman JD. The Theory of Parsing, Translation and Compiling . Vol. I. Prentice Hall; 1972. ISBN:978-0-13-914556-8
- The acronym of ‘OBject JavaScript’.
- http://alessandrorosa.altervista.org/OBJS/
- A list of comma-separated objects is included between an opening and a closing square bracket.
- An explicit array that is referred by one identifier.
- Defined ‘immediate’ for short.
- The ascending and descending tran sversion is denoted by the positive (‘ +’) and negative (‘-’) operator respectively.
- Non-conformal to the standard naming convention.
- While moving downwards to a child keeps track of the starting node, moving upwards to the parent loses this information. Advanced OOP and New Syntax Patterns for Javascript Alessandro Rosa © STM Journals 2022. All Rights Reserved 54
- At present, the formal parsing does not allow to parameterize the multiplier: for example, to input one variable: @parent(n).
- Standing at the same level and sharing the same parent node.
- Roughly speaking, when <id#1><op><id#2><assignment><id#2><op><id#1>
- For the binary operator ‘+’.
- This pattern is illegal in ordinary Javascript.
- The use strict directive in Javascript prevents to refer to undeclared variables. P HP and Javascript do not feature a rigid liveness analysis, for tracking multiple declarations of the same variable within the same scope for example.
- Particularly, of Unix–like systems.
- There exists a minor risk of falling back again into collisions between aliases anyway.
- In order to let this pattern deal with the standard var/let declaration, we followed this policy: (1) to use let only inside function and statement bodies and (2) var outside, that is, in the main code thread.
- The star operator ‘*’ follows the default implementation and it has not need to be overloaded.
- Javascript treats functions as datatypes, with the ability of instantiating them as new objects with members and prototyped methods.
- This token is not mandatory: if omitted, functions are assumed as anonymous. But just apparently at users scope, as the Javascript engine would apply a referrer to record the function into memory at a deeper level.
- The <return> token is not mandatory. Given the return and the object token inside the function body, three cases may occur: (1) both tok ens are given, ( return object): the function sends the variable object to the calling code; (2) only the return token (return ;) which actually returns no object, (3) none of the two tokens, in order to not perform any return action at all.
- The return is mandatory here.
- Overloading is part of so called extensible languages, which include tools to modify the semantics of patterns and operators [1, p. 58].
- Or also _= for the reversed, non –commutative version. Self–operators are assumed to be binary and to ‘compress’ the usual formulation: the return value is assigned to the same left argument.
- The identifier @factotum refers to an object included in the OBJS environment.
- Encoded by the decorated tokens ‘@1’ and ‘@2’.
- Alternatively, it could be applied to ‘const’ or to ‘let’ declaration.
- The abstract token <event> would be encoded by assign, decl, new, delete, function call, method call, array push and array pop.
- But we could fix it by applying this code: #overload event on _new to complex, Number.
- Depending on the nature of the container: function or class respectively.