https://github.com/csirmaz/ednascript
EdnaScript is a simple extension to JavaScript that makes it easy to write object-oriented code with class inheritance (Perl)
https://github.com/csirmaz/ednascript
ecmascript object-oriented preprocessor transpiler
Last synced: 3 months ago
JSON representation
EdnaScript is a simple extension to JavaScript that makes it easy to write object-oriented code with class inheritance (Perl)
- Host: GitHub
- URL: https://github.com/csirmaz/ednascript
- Owner: csirmaz
- Created: 2014-04-04T19:29:02.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-17T20:27:49.000Z (over 9 years ago)
- Last Synced: 2023-08-03T08:21:20.780Z (almost 2 years ago)
- Topics: ecmascript, object-oriented, preprocessor, transpiler
- Language: Perl
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# EdnaScript
EdnaScript is a simple extension to JavaScript that makes it
easy to write object-oriented code, define classes, constructors,
and inheritance between classes.This script is a prepocessor that converts source written in
EdnaScript into JavaScript (ECMAScript).EdnaScript is Copyright (C) 2014 Elod Csirmaz
This program is free software; you may redistribute it and/or modify
it under the terms of the MIT License.## Usage
ednascript.pl < INFILE.edna > OUTFILE.js
## EdnaScript Syntax
EdnaScript extends JavaScript by defining shortcuts to class and method
definitions. These shortcuts are full lines starting with a hash
(and optionally, whitespace before the hash). The following outline
lists all shortcuts:```
#class --- begins a class
#base --- determines the parent class (optional)#constructor(arguments) --- begins the constructor method
#super(arguments); --- calls the super constructor
#nosuper --- add this line if the super constructor should not be called automatically
#-constructor --- end the constructor method#method (arguments) --- begins a method
#sup(...); --- calls the overridden method
#retsup(...); --- calls the overridden method and returns its return value
#-method --- ends the method#-class --- ends the class
```## Notes
* The compiler also allows type declarations before method names and argument names,
which are simply deleted during preprocessing. For example:
```
#method bool hasprop(string property)
```* The compiler aborts if neither #super nor #nosuper is used in a constructor
of a class that has a parent class.* A file can include multiple classes.
## Example
```
#class MyPoint#constructor(float x, float y)
this._x = x;
this._y = y;
#-constructor#method string info()
return ('('+this._x+','+this._y+')');
#-method#-class
```