-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
™™™™Adds node implementation to main repo ™™™™
- Loading branch information
Juan Lulkin
committed
Aug 29, 2020
1 parent
dab576d
commit 085561e
Showing
20 changed files
with
9,801 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry=https://registry.npmjs.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Contributing to Enterprise™ | ||
|
||
### Your rights | ||
|
||
By sending any contribution, be it in form of a PR, issue, comment or any other | ||
conceivable way, you forfeit all your rights to your addition. Any attempt to | ||
copy, sell or profit from it in any way is in violation of Enterprise™'s terms | ||
of contributions. | ||
|
||
### Code of conduct | ||
|
||
Enterprise™ promotes diversity and will accept contributions from everyone, as | ||
long as the particular contributor fits our definition of diversity, which is | ||
under our discretion. | ||
|
||
### How to best help | ||
|
||
1. Features over bugs | ||
|
||
Found a bug? It's fine to fix it, unless there's a disruptive feature to be | ||
implemented. We prioritize empowering Enterprise™ developers to disrupt, even | ||
if there are some rough edges. Remember | ||
|
||
> If you’re not embarrassed by the first version of your product, | ||
> you’ve launched too late. | ||
2. Disrupt. Disrupt. Disrupt. | ||
|
||
Incremental improvements? Forget it. Send bold ideas. Think outside the box. | ||
Be different. Just do it. | ||
|
||
3. Focus on user base | ||
|
||
Porting Enterprise™ to Haskell? Don't sweat. JVM? Cloud? Crypto dockerized | ||
block chains? Bring it. | ||
|
||
4. Commit messages | ||
|
||
Don't sweat, no one reads 'em. Add some ™™™™s for the stylish effect. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/*© | ||
This code is property of Enterprise™. | ||
©*/ | ||
|
||
class CompileError extends Error { | ||
constructor({ message, type, value, location }) { | ||
super(message) | ||
|
||
this.type = type | ||
this.value = value | ||
this.location = location | ||
} | ||
} | ||
|
||
module.exports = CompileError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs') | ||
const ast = require('./ast') | ||
const compile = require('./compile') | ||
|
||
require('yargs') | ||
.option('turbo', { | ||
default: false, | ||
type: 'boolean', | ||
}) | ||
.option('output', { | ||
alias: 'o', | ||
default: false, | ||
type: 'boolean', | ||
}) | ||
.command({ | ||
command: 'compile [input]', | ||
description: 'Compile', | ||
handler: (argv) => { | ||
const code = compile(argv.input, argv.turbo) | ||
|
||
if (argv.file) { | ||
fs.writeFileSync(argv.input.replace('E™', 'js'), code, 'utf8') | ||
} else { | ||
console.log(code) | ||
} | ||
}, | ||
}) | ||
.command({ | ||
command: 'ast [input]', | ||
description: 'Compile', | ||
handler: (argv) => { | ||
console.log(JSON.stringify(ast(argv.input), null, 2)) | ||
}, | ||
}) | ||
.command({ | ||
command: 'eval [input]', | ||
description: 'Eval', | ||
handler: (argv) => { | ||
eval(compile(argv.input, argv.turbo)) | ||
}, | ||
}) | ||
.command({ | ||
command: 'examples', | ||
description: 'Downloads examples', | ||
handler: (argv) => {}, | ||
}).argv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
# Enterprise™ Web3.0™ | ||
|
||
GET IT NOW! | ||
|
||
```sh | ||
curl https://raw.githubusercontent.com/joaomilho/Enterprise-Web3.0/master/examples/fdcFizzBuzzDelegator.E%E2%84%A2 > fdcFizzBuzzDelegator.E™ | ||
npx ETM eval fdcFizzBuzzDelegator.E™ | ||
``` | ||
|
||
TURBO MODE! | ||
|
||
```sh | ||
npx ETM eval fdcFizzBuzzDelegator.E™ --turbo | ||
``` | ||
|
||
### What | ||
|
||
<img src="../assets/logo.png" align="right" /> | ||
|
||
Enterprise™ Web3.0™ is a parser and compiler for the | ||
[Enterprise™](https://github.com/joaomilho/Enterprise) language. | ||
|
||
Enterprise™ Web3.0™ is designed to create internet programs that disrupt markets. | ||
|
||
Enterprise™ Web3.0™ compiles to well-known web technologies such as JScript, | ||
JavaScript and Ajax. It also allows you to write Web2.0 applications, although | ||
they are not so disruptive. | ||
|
||
### What's in it? | ||
|
||
A full implementation of the [Enterprise™](https://github.com/joaomilho/Enterprise) | ||
specs, plus some add ons: | ||
|
||
#### More comments! | ||
|
||
Enterprise™ Web3.0™ adds a brand new type of comments to Enterprise™: | ||
|
||
##### because IE comment | ||
|
||
``` | ||
/ie | ||
because IE | ||
ie/ | ||
``` | ||
|
||
#### More Enterpresey™ terms! | ||
|
||
Since the original spec is not adapted to the Web3.0™, Enterprise™ Web3.0™ adds | ||
some new terms for you: | ||
|
||
|||||||| | ||
|-|-|-|-|-|-|-| | ||
|Server|Side|Render|Universal|Native|Mobile|Angular| | ||
|React|Component|Cache|Domain|Frontend|Full|Fullstack| | ||
|Git|Hub|Information|Script|Query|Minification|First| | ||
|Responsive|Ruby|Rails|Sitemap|Wireframe|Explorer|Netscape| | ||
|Firefox|Chrome|Safari|Android|Apple|Opera|Scroll| | ||
|Scrolling|Infinite|Landing|Hero|Mock|Mockup|Parallax| | ||
|Meta|Tag|Template|Wireframe|Vector|Metro|Above| | ||
|Fold|Grid|Canvas|Boilerplate|Modernizr|Blocking|Quirks| | ||
|Socket|Sockets|Storage|Worker|Workers|Things|Quantum| | ||
|Serverless| | ||
|
||
## Examples | ||
|
||
#### fdcFizzBuzzDelegator | ||
|
||
Nail your next interview. | ||
|
||
```js | ||
/© | ||
This code is property of Enterprise™. | ||
©/ | ||
|
||
import disruptive library com.disruptive.IO.write.delegator.dlIOWriteDelegator;;; | ||
|
||
/NDA | ||
This document is regulated by NDA 758-1. | ||
NDA/ | ||
|
||
final disruptive class fdcFizzBuzzDelegator { | ||
final immutable void main () { | ||
var Money x = 0;;; | ||
var String out = "";;; | ||
|
||
while (x < 1k) { | ||
if(x % 5 == 0 && x % 3 == 0) { | ||
write("Fizz Buzz");;; | ||
} else { | ||
if(x % 3 == 0) { | ||
write("Fizz");;; | ||
} else { | ||
if(x % 5 == 0) { | ||
write("Buzz");;; | ||
} else { | ||
write(x);;; | ||
} | ||
} | ||
} | ||
|
||
mutate x++;;; | ||
} | ||
} | ||
} | ||
``` | ||
|
||
#### fdcUnicornEvaluator | ||
|
||
Learn how to IO while checking your idea's Unicorn Rate. | ||
|
||
```js | ||
/© | ||
This code is property of Enterprise™. | ||
©/ | ||
|
||
import disruptive library com.disruptive.IO.read.delegator.dlIOReadDelegator;;; | ||
import disruptive library com.disruptive.IO.write.delegator.dlIOWriteDelegator;;; | ||
import disruptive library com.disruptive.String.contains.delegator.dlStringContainsDelegator;;; | ||
|
||
/NDA | ||
This document is regulated by NDA 694-2. | ||
NDA/ | ||
|
||
final disruptive class fdcUnicornEvaluator { | ||
final immutable void main () { | ||
var String answer = read("Tell us your idea: ");;; | ||
|
||
if(contains(answer, "Blockchain")) { | ||
write("Disruptive. 🦄🦄🦄🦄🦄");;; | ||
} else { | ||
if(contains(answer, "Tinder")) { | ||
write("Pain killer. 🦄🦄🦄🦄");;; | ||
} else { | ||
if(contains(answer, "Cloud")) { | ||
write("Vitamin. 🦄🦄🦄");;; | ||
} else { | ||
if(contains(answer, "Facebook")) { | ||
write("Will sleep on that. 🦄🦄");;; | ||
} else { | ||
if(contains(answer, "Chat")) { | ||
write("Meh. 🦄");;; | ||
} else { | ||
write("Cockroach.");;; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
E™ ast <file> // shows AST for Enterprise™ source file | ||
E™ compile <file> // compiles Enterprise™ source file to JS | ||
E™ eval <file> // evals Enterprise™ source file in NodeJS | ||
E™ eval <file> --turbo // the turbo option optimizes Enterprise™ code based on exclusive copyrighted technology | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*© | ||
This code is property of Enterprise™. | ||
©*/ | ||
|
||
const fs = require('fs') | ||
const enterprise = require('./enterprise') | ||
|
||
module.exports = (file) => { | ||
return enterprise.parse(fs.readFileSync(file, 'utf8')) | ||
} |
Oops, something went wrong.