fazer-lang 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -80
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,137 +1,200 @@
|
|
|
1
|
-
# Fazer Language
|
|
1
|
+
# Fazer Language Reference Manual
|
|
2
2
|
|
|
3
|
-
> **The
|
|
4
|
-
>
|
|
3
|
+
> **The Next-Generation Scripting Language for High-Performance Computing & Security.**
|
|
4
|
+
> *Copyright © 2026 L'EMPRISE. All Rights Reserved.*
|
|
5
5
|
|
|
6
6
|
[](https://www.npmjs.com/package/fazer-lang)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Introduction
|
|
12
|
+
|
|
13
|
+
**Fazer (fz)** is not just another scripting language. It is a precision tool engineered by **L'EMPRISE** for developers who demand **clarity**, **security**, and **efficiency**.
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
Unlike traditional languages that bury logic in verbose syntax, Fazer prioritizes the **Data Flow**. By utilizing the revolutionary Arrow Pipe Operator (`→>`), Fazer allows data to flow naturally from one operation to the next, mirroring the human thought process.
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
### Why Fazer?
|
|
18
|
+
|
|
19
|
+
* **Superior Readability**: Logic flows left-to-right. No more nesting hell `func(func(func(x)))`.
|
|
20
|
+
* **Security First**: AES-256-GCM encryption is a first-class citizen, not an afterthought.
|
|
21
|
+
* **Batteries Included**: HTTP Server, FileSystem, System Execution, and JSON parsing are built-in. No external dependencies required for standard tasks.
|
|
22
|
+
* **Universal Compatibility**: Runs on any Node.js environment or compiles to a standalone, dependency-free Binary (EXE/Linux).
|
|
23
|
+
|
|
24
|
+
---
|
|
21
25
|
|
|
22
|
-
##
|
|
26
|
+
## 2. Installation
|
|
27
|
+
|
|
28
|
+
### Global Installation (Recommended)
|
|
29
|
+
To access the `fazer` command globally on your system:
|
|
23
30
|
|
|
24
31
|
```bash
|
|
25
32
|
npm install -g fazer-lang
|
|
26
33
|
```
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
### Verification
|
|
36
|
+
```bash
|
|
37
|
+
fazer --version
|
|
38
|
+
# Output: 2.1.0
|
|
39
|
+
```
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
---
|
|
31
42
|
|
|
32
|
-
|
|
33
|
-
fn main() →
|
|
34
|
-
box("WELCOME", "Hello from Fazer!", style("Power is yours.", "cyan"))
|
|
35
|
-
|
|
36
|
-
# Pipe magic
|
|
37
|
-
"secret message" →> sha256() →> println()
|
|
38
|
-
end
|
|
43
|
+
## 3. The Core Philosophy: The Pipe (`→>`)
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
In most languages, you write:
|
|
46
|
+
```javascript
|
|
47
|
+
// JavaScript / Python style
|
|
48
|
+
print(sha256(readFile("data.txt")));
|
|
41
49
|
```
|
|
50
|
+
This requires reading "inside-out".
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
|
|
52
|
+
**In Fazer, you write:**
|
|
53
|
+
```fazer
|
|
54
|
+
"data.txt" →> readText() →> sha256() →> print()
|
|
46
55
|
```
|
|
56
|
+
This is the **Pipeline Architecture**. The result of the left side is automatically injected as the *first argument* of the function on the right.
|
|
57
|
+
|
|
58
|
+
---
|
|
47
59
|
|
|
48
|
-
##
|
|
60
|
+
## 4. Language Guide
|
|
49
61
|
|
|
50
|
-
###
|
|
51
|
-
|
|
62
|
+
### Variables & Constants
|
|
63
|
+
Fazer uses dynamic typing. Variables are declared implicitly.
|
|
52
64
|
|
|
53
65
|
```fazer
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# Fazer Style
|
|
58
|
-
"text" →> sha256() →> println()
|
|
66
|
+
x = 10
|
|
67
|
+
name = "L'EMPRISE"
|
|
68
|
+
isActive = true
|
|
59
69
|
```
|
|
60
70
|
|
|
61
|
-
###
|
|
71
|
+
### Data Types
|
|
72
|
+
* **String**: `"Hello World"` (supports concatenation with `+`)
|
|
73
|
+
* **Number**: `42`, `3.14`
|
|
74
|
+
* **Boolean**: `true`, `false`
|
|
75
|
+
* **Object/Map**: `{"key": "value"}`
|
|
76
|
+
* **Null**: `null`
|
|
77
|
+
|
|
78
|
+
### Control Flow: The Power of `case`
|
|
79
|
+
Fazer replaces the archaic `if/else/switch` with a unified, powerful `case` structure.
|
|
62
80
|
|
|
63
|
-
**Functions (`fn`)**
|
|
64
81
|
```fazer
|
|
65
|
-
fn
|
|
66
|
-
|
|
82
|
+
fn analyze(val) →
|
|
83
|
+
case val
|
|
84
|
+
0 → println("Zero detected") end
|
|
85
|
+
> 100 → println("High value detected") end
|
|
86
|
+
"admin" → println("Access Granted") end
|
|
87
|
+
else → println("Unknown value") end
|
|
88
|
+
end
|
|
67
89
|
end
|
|
68
90
|
```
|
|
69
91
|
|
|
70
|
-
|
|
71
|
-
|
|
92
|
+
### Functions (`fn`)
|
|
93
|
+
Functions are first-class citizens.
|
|
72
94
|
|
|
73
95
|
```fazer
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
> 10 → println("Greater than ten") end
|
|
77
|
-
else → println("Something else") end
|
|
96
|
+
fn multiply(a, b) →
|
|
97
|
+
return(a * b)
|
|
78
98
|
end
|
|
99
|
+
|
|
100
|
+
# Using with pipe
|
|
101
|
+
5 →> multiply(10) →> println() # Output: 50
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 5. Standard Library Reference (StdLib)
|
|
107
|
+
|
|
108
|
+
Fazer comes equipped with a professional-grade standard library.
|
|
109
|
+
|
|
110
|
+
### 5.1. Input / Output & UI (`IO`)
|
|
111
|
+
|
|
112
|
+
* **`print(val)`**: Prints value to stdout (no newline).
|
|
113
|
+
* **`println(val)`**: Prints value with newline.
|
|
114
|
+
* **`ask(prompt)`**: Pauses execution and waits for user input. Returns the string entered.
|
|
115
|
+
* **`style(text, color)`**: Applies ANSI colors to text.
|
|
116
|
+
* *Colors*: `"red"`, `"green"`, `"yellow"`, `"blue"`, `"magenta"`, `"cyan"`, `"white"`, `"gray"`.
|
|
117
|
+
* **`box(title, lines...)`**: Renders a professional ASCII interface box. Automatically handles alignment and ANSI codes.
|
|
118
|
+
|
|
119
|
+
```fazer
|
|
120
|
+
box("SYSTEM ALERT", "Access Restricted", style("L'EMPRISE Protocol", "red"))
|
|
79
121
|
```
|
|
80
122
|
|
|
81
|
-
###
|
|
123
|
+
### 5.2. Cryptography (`Crypto`)
|
|
124
|
+
**Security Level: Military Grade (AES-256-GCM).**
|
|
125
|
+
|
|
126
|
+
* **`sha256(data)`**: Returns the SHA-256 hash of the data (hex string).
|
|
127
|
+
* **`encText(plainText, password)`**: Encrypts text using AES-256-GCM. Returns a secure JSON string containing IV, AuthTag, and Ciphertext.
|
|
128
|
+
* **`decText(encryptedJson, password)`**: Decrypts the JSON string. Throws error if password is wrong or integrity is compromised.
|
|
82
129
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
* `style(text, color)`: Colorize text (red, green, blue, cyan, yellow, etc.).
|
|
88
|
-
* `box(title, lines...)`: Draw a beautiful ASCII box (handles ANSI colors correctly!).
|
|
130
|
+
```fazer
|
|
131
|
+
pass = "super_secret"
|
|
132
|
+
"My Secret Data" →> encText(pass) →> saveText("secret.enc")
|
|
133
|
+
```
|
|
89
134
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* `readB64(path)` / `saveB64(content, path)`
|
|
93
|
-
* `exists(path)`: Returns true/false.
|
|
94
|
-
* `ls(dir)`: List files.
|
|
95
|
-
* `rm(path)`: Delete file/dir (recursive).
|
|
96
|
-
* `mkdir(path)`: Create directory.
|
|
135
|
+
### 5.3. File System (`FS`)
|
|
136
|
+
Robust, synchronous file operations.
|
|
97
137
|
|
|
98
|
-
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
138
|
+
* **`readText(path)`**: Reads file as UTF-8 string.
|
|
139
|
+
* **`saveText(content, path)`**: Writes string to file (overwrites).
|
|
140
|
+
* **`readB64(path)`**: Reads file as Base64 string (useful for binaries).
|
|
141
|
+
* **`saveB64(content, path)`**: Writes Base64 string to file.
|
|
142
|
+
* **`exists(path)`**: Returns `true` if file/directory exists, `false` otherwise.
|
|
143
|
+
* **`ls(path)`**: Returns an array of file names in the directory.
|
|
144
|
+
* **`rm(path)`**: Recursively deletes a file or directory. **Handle with care.**
|
|
145
|
+
* **`mkdir(path)`**: Creates a directory (recursive).
|
|
102
146
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
* `exec(cmd)`: Run a shell command (e.g., `exec("dir")`).
|
|
106
|
-
* `json(obj)`: Convert object to JSON string.
|
|
107
|
-
* `parseJson(str)`: Parse JSON string to object.
|
|
147
|
+
### 5.4. Networking & Web (`Net`)
|
|
148
|
+
Create high-performance web servers instantly.
|
|
108
149
|
|
|
109
|
-
|
|
150
|
+
* **`server(port, handlerFunctionName)`**: Starts a blocking HTTP server.
|
|
110
151
|
|
|
152
|
+
**Example Web Server:**
|
|
111
153
|
```fazer
|
|
112
|
-
fn
|
|
113
|
-
|
|
154
|
+
fn handler(req) →
|
|
155
|
+
# req has .method, .url, .headers
|
|
156
|
+
println("Hit: " + req.url)
|
|
157
|
+
|
|
114
158
|
return({
|
|
115
159
|
"status": 200,
|
|
116
|
-
"headers": { "Content-Type": "
|
|
117
|
-
"body": "
|
|
160
|
+
"headers": { "Content-Type": "application/json" },
|
|
161
|
+
"body": json({ "message": "Welcome to Fazer API" })
|
|
118
162
|
})
|
|
119
163
|
end
|
|
120
164
|
|
|
121
|
-
|
|
122
|
-
server(8080, "handleRequest")
|
|
165
|
+
server(3000, "handler")
|
|
123
166
|
```
|
|
124
167
|
|
|
168
|
+
### 5.5. System & Utilities (`Sys`)
|
|
169
|
+
|
|
170
|
+
* **`exec(command)`**: Executes a shell command and returns the output (stdout).
|
|
171
|
+
* **`json(obj)`**: Serializes an object/array to a JSON string.
|
|
172
|
+
* **`parseJson(jsonString)`**: Parses a JSON string into an object.
|
|
173
|
+
|
|
125
174
|
---
|
|
126
175
|
|
|
127
|
-
##
|
|
176
|
+
## 6. Advanced Usage: Building Standalone Executables
|
|
128
177
|
|
|
129
|
-
|
|
178
|
+
You can compile your Fazer scripts into standalone executables (`.exe` for Windows, binary for Linux) that do not require Node.js or Fazer to be installed on the target machine.
|
|
130
179
|
|
|
180
|
+
**Command:**
|
|
131
181
|
```bash
|
|
132
|
-
|
|
182
|
+
# Requires 'pkg' installed via npm
|
|
183
|
+
pkg fazer.js --targets node18-win-x64,node18-linux-x64 --output my_app
|
|
133
184
|
```
|
|
134
185
|
|
|
135
|
-
|
|
186
|
+
This capability makes Fazer the ideal choice for deploying secure, self-contained tools to client environments.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 7. Copyright & Legal
|
|
191
|
+
|
|
192
|
+
**Fazer Language** is a proprietary technology developed by **L'EMPRISE**.
|
|
193
|
+
Unauthorized reproduction of the core interpreter logic without attribution is prohibited.
|
|
194
|
+
|
|
195
|
+
* **Copyright**: © 2026 L'EMPRISE.
|
|
196
|
+
* **License**: MIT (Open Source for usage).
|
|
197
|
+
|
|
198
|
+
---
|
|
136
199
|
|
|
137
|
-
|
|
200
|
+
> *"Control the code, control the world."* — **L'EMPRISE**
|
package/package.json
CHANGED