Commit Graph

39 Commits

Author SHA1 Message Date
hkau 74352a5118 [fix] conditionals
TODO: conditionals (second layer and beyond)
2024-04-02 21:38:00 -04:00
hkau 5e40183d20 [add] modules::fs::mkdir
[add] modules::math::mod (modulo)
2024-02-24 21:31:17 -05:00
hkau 878a785dd9 [add] grammar: ARRAY_SELECT
[add] interpret: ability to select items from an array
arr[i]
2024-02-23 19:13:34 -05:00
hkau b952f61eb2 [add] modules::fs
[add] modules::fs::read_utf8
[add] modules::fs::write_utf8
[add] modules::fs::remove
TODO: modules::fs - remove_dir, mkdir, read_dir (into array)
[add] modules::math::eq
[add] modules::math::neq
[add] modules::math::not
[add] modules::math::con_eval
[add] don't import all standard library functions by default
2024-02-22 17:38:32 -05:00
hkau 5fade5e530 [add] modules::time::now
[add] modules::methods::string::replace
[add] modules::methods::string::replacen
[add] modules::methods::string::replaceall
2024-02-20 22:18:21 -05:00
hkau 98ac64d96a [add] modules::regex
[add] modules::regex::match
adds regex to the standard library
2024-02-20 18:27:37 -05:00
hkau d68036a362 [add] modules::math
[add] modules::math::add
[add] modules::math::sub
[add] modules::math::mul
[add] modules::math::div
[add] modules::math::pow
[add] modules::math::abs
these are intended to correspond to OPERATOR symbols such as plus for math::add
[fix] modules::state
[fix] modules::time
[fix] modules::standard
[fix] modules::os
[add] grammar: accept "true" and "false" as bool values too
[add] interpret: inherit modules::methods::default on "FNDEC"
[add] modules::methods::default::is_none
[add] modules::methods::default::is_some
[add] modules::methods::table::query
[add] modules::methods::table::query_fn
[chore] bump version (v0.7.1 -> v0.7.2)
2024-02-19 17:20:12 -05:00
hkau 70ed891d74 [add] modules::standard::require
allows you to import external scripts and use their return
[add] modules::methods::table::enumerate
[add] modules::methods::table::iter (enumerate alias)
[chore] bump version (v0.7.0 -> v0.7.1)
2024-02-18 22:38:20 -05:00
hkau d083f18f3b [fix] interpret: user defined functions
[add] interpret: ability to define functions under "table" objects
functions cannot be defined during table init, but can be afterwards
[fix] interpret: Lua syntax support
[add] grammar: change type name (STRING -> string)
[add] grammar: change type name (FLOAT -> number)
[add] grammar: change type name (ARRAY -> array)
[add] grammar: change type name (TUPLE -> tuple)
[add] grammar: change type name (JSON -> table)
[add] grammar: change type name (BOOL -> bool)
[add] grammar: change type name (VALUE -> any)
[add] grammar: change type name (NULL -> null)
[chore] bump version (v0.6.4 -> v0.7.0)
2024-02-18 14:45:24 -05:00
hkau 4142835148 [add] grammar: nested json
[add] interpret: nested json
[add] modules::methods::string::format_table
[add] grammar: ASSIGN_JSON
[add] interpret: ability to reassign values in a JSON input with a quick syntax
instead of having to directly call "__setitem__", you can now just do "jsoninput.key = 1" (example)
[add] modules::methods::json::__setitem__ - ability to assign to nested values
[add] modules::state
[add] modules::state::getvars
returns an interpreter JSON representation of the KvKfnStore that is currently present
[chore] bump version (v0.6.3 -> v0.6.4)
2024-02-17 18:51:33 -05:00
hkau e0a1a2f0ff [add] modules::methods::json::__getitem__ chaining
allows you to select deeply nested items (root.object.object.etc.value)
[add] modules::methods::default::inspect
allows you to get an interpreter json representation of a ReturnValue
2024-02-16 17:59:53 -05:00
hkau 9972e3f1b1 [add] grammar: JSON, JSON_OBJECT, JSON_SELECT
[add] interpret: JSON (table), JSON_SELECT
[add] modules::methods::json
[add] modules::methods::json::__getitem__
[add] modules::methods::json::__setitem__
[add] modules::methods::json::contains(::has)
[add] modules::methods::string::isupper
[add] modules::methods::string::islower
[chore] update version (v0.6.2 -> v0.6.3)
2024-02-15 21:54:47 -05:00
hkau dfb83a5469 [add] modules::methods::string::istitle
[add] modules::methods::string::issnake
[add] modules will now use "::" instead of "." for module functions
[add] modules::os
[add] modules::os::getenv
2024-02-14 22:34:12 -05:00
hkau b8e28f99d0 [add] grammar: CLASSDEC
[add] interpret: "attributes" in ReturnValue
[add] interpret: KvKfnStore
TODO: classes
2024-02-13 19:27:40 -05:00
hkau 69c1c177cb [add] grammar: TUPLE_SELECT
you can quick select items from tuples in a rust-like syntax ("tuple.0")
TODO: ARRAY_SELECT ("array[0]")
[add] modules::methods::tuple
[add] modules::methods::tuple::__getitem__
[add] modules::methods::tuple::contains
[add] modules::methods::array::append
[add] modules::methods::array::contains
[add] modules::methods::array::enumerate
[add] modules::methods::string::isdigit
[add] modules::methods::string::contains
[chore] bump version (v0.6.1 -> v0.6.2)
2024-02-12 19:00:34 -05:00
hkau af30982cb7 [add] interpret: "FORLOOP" with ARRAY as iter
[add] interpret: default methods
[add] modules::standard::println
[add] modules::standard::printr
[add] uniform error messages
2024-02-10 19:50:08 -05:00
hkau b897d7d66c [add] rustdoc documentation
[add] reformat method files
2024-02-09 23:10:54 -05:00
hkau a248d83f54 [add] interpret: in-place reassignment
[add] modules::methods::string - #STRING::isalpha
[add] modules::methods::string - #STRING::isalnum
[add] modules::methods::array
[add] modules::methods::array - #ARRAY::__getitem__
[add] modules::methods::array - #ARRAY::__setitem__
[fix] grammar: whitespace in ARRAY and TUPLE
[add] interpret: "children" property in ReturnValue struct
[add] interpret: call_method
[fix] interpret: clean reused code
[add] support (some) lua syntax
[chore] bump version (v0.5.4 -> v0.6.0)
2024-02-09 21:20:17 -05:00
hkau 6ccab7c5e8 [add] interpret: 1-level "elif" conditional
[add] interpret: function returns ("return" variable export)
[fix] parser: automatically "dump()" function body
[fix] modules::standard - don't require argument in "#input"
2024-02-08 20:33:08 -05:00
hkau 8ca01ed7a1 [add] interpret: basic for loops
[add] grammar: FORLOOP (BLOCKS)
[add] modules::standard - "#range" function
2024-02-06 21:39:23 -05:00
hkau 680b4450d1 [add] interpret: modules::standard
[add] interpret: standard library "abs", "bits", "id", "input", "pow", "repr"
implements many functions from the python standard library
[add] interpret/grammar: chained method calls
fixed METHODCALL to accept chains
2024-02-05 20:12:02 -05:00
hkau 103d2054fb [add] methods(string): lower, upper, strip 2024-02-04 23:51:51 -05:00
hkau 22d4f3bb91 [add] interpret: instance methods
[add] grammar: METHODCALL
[add] modules::methods::string
[add] modules::methods
[add] interpret: give standard functions access to variables HashMap
[add] array/tuple values
2024-02-04 15:30:25 -05:00
hkau 3675c4ece7 [add] interpret: "else" conditional block
[add] grammar: CONDITIONAL_ELSE
[add] proper support for booleans
[fix] weird python booleans: "true" -> "True"
[fix] weird python booleans: "false" -> "False"
[chore] bump version (v0.5.0 -> v.0.5.1)
2024-02-03 23:52:00 -05:00
hkau 6056ebefba [add] grammar: CONDITIONAL_IF, QUICK_CONDITIONAL_IF, OPERATOR
[fix] grammar: FNDEC
[add] interpret: import modules (time module)
"import" expression not accepted **yet**
[add] interpret: single comparison conditional
TODO: implement "else", "elif"
[add] parser: proper error messages
[add] parser: automatically convert indented scopes to have an ending
closes all expressions with "<end>"
[chore] bump version (v0.4.0 -> v0.5.0)
2024-02-03 19:38:29 -05:00
hkau 7fa5f5287a [fix] FNDEC (kind of)
TODO: fix NESTED function declarations
possible require functions to have a return value
[fix] ReturnValue::as_printable
2024-02-02 22:51:06 -05:00
hkau a75bb7ed28 [add] rt_functions: time.sleep
[add] rt_functions: type
[add] actual support for function arguments (kind of)
[add] make Rule::NULL printable
[add] impl for ReturnValue
2024-02-02 20:11:13 -05:00
hkau a079e9bd6b [fix] interpret: nested function calls
example: print(len(1))
[add] interpret: support STRING and FLOAT in "#print"
[add] interpret: "len()" function
2024-02-01 18:35:57 -05:00
hkau 1910e2d42c [fix] interpret: variable declaration
[fix] interpret: get_variable
TODO: fix FNCALL from within FNCALL
TODO: fix FNCALL returns
TODO: fix FNDEC
TODO: ARRAY, TUPLE datatypes
2024-01-31 23:55:43 -05:00
hkau 4caace9820 [add] rewrite interpreter
[add] switch to PEG-based parser (pest)
[add] parser: base
2024-01-30 22:30:35 -05:00
hkau 0e7f1d7fd8 [add] function returns
[add] len() function support
TODO: fix function argument matching
TODO: fix FnDec argument matching
TODO: fix comments (they shouldn't be parsed)
2024-01-29 18:51:29 -05:00
hkau f9a9471954 [add] ast: function definition
[add] interpret: function definition and user-defined function calls
2024-01-28 15:32:41 -05:00
hkau c4b99f73fb [add] skip by characters instead of blocks
[add] interpret: ability to call functions from an FnCall's parameters
[fix] ast: "Raw" detection
2024-01-27 16:21:53 -05:00
hkau 12a29da957 [add] ast: use AMBlock.children based system over attributes
this approach uses scoped parsing over a system based on arguments_state
[add] ast: array
[add] interpreter: array can be used as value
[remove] ast: arg_of_previous_FnCall
[remove] ast: next_is_arg
[fix] ast: "Raw" detection
TODO: fix calling a function from within a function call argument
[chore] bump version (v0.1.0 -> v0.2.0) (breaking)
2024-01-27 13:21:57 -05:00
hkau 7c0f118c02 [add] "--json" and "--save"
[add] ability to load AST from JSON file
[fix] function parameter matching
2024-01-26 21:43:54 -05:00
hkau 6e3baabef0 [add] interpret
[add] interpret: "print" function
TODO: fix AST argument labeling (if the previous few characters contains a comma the block should be an argument too!)
2024-01-26 20:47:56 -05:00
hkau f1747ca3f1 [fix] ast: correct start value for FnCall and FnDec
[fix] argument placement for FnCall ("next_is_arg" state)
2024-01-25 22:02:30 -05:00
hkau 0b11f4aa36 [add] ast: remove VarDec
instead, the interpreter should check if the very next block after a "Raw" block is an equal sign.. if it is, the very next block after is the variable value!
[add] ast generation time benchmark when "--ast" is given
2024-01-25 21:07:20 -05:00
hkau 7854d28102 Initial 2024-01-25 20:00:23 -05:00