-
Notifications
You must be signed in to change notification settings - Fork 11
TODO & Roadmap
Jakub T. Jankiewicz edited this page May 22, 2024
·
26 revisions
- Parser
- variables
- strings
- regexes
- arrays
- dictionaries
- booleans
- integers
- floats
- property access
- nested property access
- Here docs - for figlet ASCII art
- array indexing
- dicts/structs for data
-
if/else
statements - globals
- cookie
- set cookie
- argv (process.argv) or null
- location or null
- access nested properties
- set location and redirect
- cookie
- loops
-
for
..in
-
while
-
-
try
..catch
..end
-
do
..end
blocks - comments with
#
- Functions
- Functions
return
keyword -
*args
-> rest and spread - Lambda
- Functions return functions
- Implementation of
map
/reduce
/filter
using gaiman
- Functions
- Commands (restricted names)
-
ask
- set prompt -
echo
- print message- explicit
"\n"
(user can change using config)
- explicit
-
clear
- clear terminal -
mask
- mask the input for secrets -
get
- send HTTP GET request -
post
- send HTTP POST request -
exit
- to end the program -
let
- save expression or command into variable -
there isexists
...in
- check if item is in array[].includes
. -
parse
- parse string to number, boolean or regex -
sleep
- pause the terminal using setTimeout-
sleep*
- keep prompt visible
-
-
string method existssplit
- to create array with string or regex separator -
array method existsjoin
- return string from array -
array method existspush
- item into array -
array method existspop
- remote item from - Optional parenthesis for
echo* (get "https://jcubic.pl"), 100
- style commands (some ingored in Node)
- color
- background
- size
- font
- cursor
- Animation commands
- prompt*
- input*
- echo*
- ask*
-
- Not operator inside if statements
- Expressions
- regex match
~=
-
$1
variables - comparators
==
/<=
/>=
/<
/>
- parentheses for grouping
-
-=
,+=
,/=
,*=
operators -
-
,+
,/
,*
and%
operators
- regex match
- variables
- compiler functions to JavaScript code escodegen.
- Compile everything to JavaScript
- Unit tests
- jQuery Terminal integration
- Async Adapters for Web
- Async Adapters for Terminal
- XML like syntax for colors
<bold><red>hello</red></bold>
(added xml formatting) - STD
- Date object
- URL parser
- Modules from URL
- Parse string to int
- isNaN
- Array methods
join
/push
/pop
(maybe allow all JS methods) - String methods
split
/replace
-
ord
/chr
- Hooks to embed JS code
@pragma inject
function $_sum(...args) {
return args.reduce((a, b) => a + b);
}
@end
echo sum(1, 2, 3);
TODO: syntax example
echo <<GREET
____ _
/ ___| __ _(_)_ __ ___ __ _ _ __
| | _ / _` | | '_ ` _ \ / _` | '_ \
| |_| | (_| | | | | | | | (_| | | | |
\____|\__,_|_|_| |_| |_|\__,_|_| |_|
Gaiman Engine
Copyright (C) 2021 Jakub Jankiewicz <https://jcubic.pl/me>
Released under GPLv3 license
GREET
if location then
echo "Wellcome on this website"
else
echo "Wellcome to this CLI app"
end
let env = []
let items = ["bottle", "flower"]
let command = ask "? "
if command ~= /pick (.+)/ then
if $1 then
if exists $1 in items then
env.push($1)
pop items
else
echo "invalid item"
end
else
echo "What do you want topick"
end
end
let stop = false
let count = 0
while not stop do
let command = ask "? "
if command ~= /exit/
stop = true
echo "goodby"
else if command ~= /add ([0-9]+)/ then
count += parse $1
echo "corrent count $count"
else
echo "your command $command"
end
end
def once(fn)
let result = null
return lambda(...args)
if result == null then
result = fn(...args)
end
return result
end
end
def map(fn, array)
let result = []
for item in array do
result.push(fn(item))
end
return result
end
To consider
- do we need
set
maybefoo = ??
is enough - scope for variales (php with global is not good idea)
- methods (JS Array/String)
- standard library (e.g.:
push
/pop
/split
/join
) - functions should be compiled to JavaScript, use
command = ask "? "
should be compile to:
var command = await term.read('? ')
NOTE: should there be implicit var? Maybe force using let to declare variables.
Compile:
do
let x = 10
echo x + x
end
x # throw exception x is not defined
to
{
let $_x = 10
term.echo($_x + $_x);
}
$_x
All names prefixed with $_
to solve conflicts
class Adapter {
constructor() { }
async ask(message) { }
echo(string) { }
async get(url) { }
async post(url, data) { }
start() { }
}
functon is_node() {
return typeof process !== 'undefined' &&
process.release.name === 'node';
}
var term, $_location, $_argv
if (is_node()) {
term = new NodeAdapter();
$_argv = process.argv;
} else {
term = new WebAdapter();
$_location = location;
}
term.start();
Gaiman Programming Language - Copyright 2021-2022 Jakub T. Jankiewicz
Released with GNU GPL v3 License