├── .gitattributes ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── benchmark ├── array.ltn ├── call.ltn ├── fx_capture_lambda.ltn ├── fx_empty_lambda.ltn ├── fx_pointer.ltn ├── member.ltn ├── memory.ltn ├── range.ltn ├── run.sh ├── run_fx.sh ├── run_o.sh ├── string.ltn └── switch.ltn ├── build.sh ├── clear.sh ├── diagnostics ├── error │ ├── assign.ltn │ ├── binary_add.ltn │ └── unary_neg.ltn └── run.sh ├── doc ├── c_api │ ├── allocation.md │ ├── array.md │ ├── creating_a_plugin.md │ ├── map.md │ ├── string.md │ ├── tuple.md │ ├── types.md │ └── value_api.md ├── language │ ├── Coroutines.md │ ├── Defines.md │ ├── Enums.md │ ├── Expression.md │ ├── Function-Pointer.md │ ├── Functions.md │ ├── IterationInvalidation.md │ ├── MemberFunction.md │ ├── Modules.md │ ├── Namespaces.md │ ├── Operators.md │ ├── Reflection.md │ ├── SpecialMemberFunction.md │ ├── Statement.md │ ├── StaticInitialization.md │ ├── SymbolResolution.md │ ├── TypeCategories.md │ ├── Variables.md │ └── naming.md ├── stdlib │ ├── algorithm │ │ ├── copy.md │ │ ├── fill.md │ │ ├── find.md │ │ ├── fold_x.md │ │ ├── for_each.md │ │ ├── is_sorted.md │ │ ├── reverse.md │ │ ├── sort.md │ │ ├── sum.md │ │ ├── transform.md │ │ └── zip.md │ ├── bits │ │ ├── get.md │ │ └── set.md │ ├── call_stack_depth.md │ ├── chrono │ │ ├── clock.md │ │ ├── to_milliseconds.md │ │ ├── to_seconds.md │ │ └── wait.md │ ├── container │ │ ├── array.md │ │ ├── at.md │ │ ├── back.md │ │ ├── contains.md │ │ ├── empty.md │ │ ├── front.md │ │ ├── insert.md │ │ ├── map.md │ │ ├── peek.md │ │ ├── pop.md │ │ ├── push.md │ │ ├── queue.md │ │ ├── remove.md │ │ ├── size.md │ │ └── stack.md │ ├── functional │ │ ├── arity.md │ │ ├── chain.md │ │ ├── external.md │ │ ├── invoke.md │ │ └── is_variadic.md │ ├── io │ │ ├── is_eof.md │ │ ├── istream │ │ │ ├── cin.md │ │ │ ├── fin.md │ │ │ └── strin.md │ │ ├── ostream │ │ │ ├── cout.md │ │ │ ├── fout.md │ │ │ └── strout.md │ │ ├── print.md │ │ ├── println.md │ │ ├── read.md │ │ ├── read_all.md │ │ ├── read_bool.md │ │ ├── read_char.md │ │ ├── read_float.md │ │ ├── read_int.md │ │ └── readln.md │ ├── iter │ │ ├── get.md │ │ ├── is_stop.md │ │ ├── iter.md │ │ ├── move.md │ │ ├── next.md │ │ ├── range.md │ │ ├── reversed.md │ │ └── zipped.md │ ├── json │ │ ├── parse.md │ │ └── print.md │ ├── math │ │ ├── abs.md │ │ ├── cbrt.md │ │ ├── ceil.md │ │ ├── clamp.md │ │ ├── cos.md │ │ ├── e.md │ │ ├── floor.md │ │ ├── hypot.md │ │ ├── is_between.md │ │ ├── ld.md │ │ ├── lerp.md │ │ ├── lg.md │ │ ├── ln.md │ │ ├── log.md │ │ ├── max.md │ │ ├── min.md │ │ ├── pi.md │ │ ├── pow.md │ │ ├── round.md │ │ ├── sin.md │ │ ├── sqrt.md │ │ ├── tan.md │ │ └── tau.md │ ├── random │ │ ├── decision.md │ │ ├── mersenne.md │ │ ├── rand.md │ │ ├── rand_element.md │ │ ├── rand_float.md │ │ ├── rand_int.md │ │ └── split.md │ ├── string.md │ └── type │ │ ├── cast.md │ │ ├── clone.md │ │ ├── has_special_add.md │ │ ├── has_special_cmp.md │ │ ├── has_special_div.md │ │ ├── has_special_mlt.md │ │ ├── has_special_mod.md │ │ ├── has_special_pow.md │ │ ├── has_special_str.md │ │ ├── has_special_sub.md │ │ ├── is.md │ │ ├── is_.md │ │ ├── match_type.md │ │ ├── mono.md │ │ ├── null_v.md │ │ ├── pair.md │ │ └── struct.md ├── technical │ ├── components.drawio │ ├── intrinsics │ ├── nodes.md │ └── pipeline.drawio └── types │ ├── array.md │ ├── bool.md │ ├── clock.md │ ├── coroutine.md │ ├── float.md │ ├── function_pointers.md │ ├── int.md │ ├── istream.md │ ├── map.md │ ├── null.md │ ├── ostream.md │ ├── queue.md │ ├── rng.md │ ├── stack.md │ ├── string.md │ ├── struct.md │ └── tuple.md ├── examples ├── newtons_method.ltn ├── newtons_method.sh ├── run_all.sh ├── skytale.ltn ├── skytale.sh ├── unicode.ltn └── unicode.sh ├── install.sh ├── litan ├── CMakeLists.txt ├── commands │ ├── build.cxx │ ├── build.hxx │ ├── dump.cxx │ ├── dump.hxx │ ├── exec.cxx │ ├── exec.hxx │ ├── run.cxx │ └── run.hxx ├── litan.cxx └── shared │ ├── file.cxx │ ├── file.hxx │ ├── help.cxx │ ├── help.hxx │ ├── options.cxx │ └── options.hxx ├── litan_compiler ├── AddressTable.hxx ├── CMakeLists.txt ├── CompilerError.cxx ├── CompilerError.hxx ├── Instructions.hxx ├── Label.cxx ├── Label.hxx ├── Ltnc.cxx ├── Ltnc.hxx ├── Namespace.cxx ├── Namespace.hxx ├── Operations.hxx ├── Qualifiers.cxx ├── Qualifiers.hxx ├── SourceLocation.hxx ├── analyze │ ├── CMakeLists.txt │ ├── analyze.cxx │ ├── analyze.hxx │ ├── analyze_array.cxx │ ├── analyze_binary.cxx │ ├── analyze_bindings.cxx │ ├── analyze_block.cxx │ ├── analyze_call.cxx │ ├── analyze_conditional.cxx │ ├── analyze_custom_literal.cxx │ ├── analyze_enum.cxx │ ├── analyze_expression.cxx │ ├── analyze_function.cxx │ ├── analyze_fx_ptr.cxx │ ├── analyze_if_else.cxx │ ├── analyze_iife.cxx │ ├── analyze_index.cxx │ ├── analyze_init.cxx │ ├── analyze_lambda.cxx │ ├── analyze_loops.cxx │ ├── analyze_newvar.cxx │ ├── analyze_params_args.cxx │ ├── analyze_primitives.cxx │ ├── analyze_read.cxx │ ├── analyze_reflect.cxx │ ├── analyze_return.cxx │ ├── analyze_statement.cxx │ ├── analyze_static.cxx │ ├── analyze_switch.cxx │ ├── analyze_ternary.cxx │ ├── analyze_throw.cxx │ ├── analyze_unary.cxx │ ├── analyze_write.cxx │ ├── analyze_yield.cxx │ ├── error.cxx │ ├── error.hxx │ ├── optimize │ │ ├── CMakeLists.txt │ │ ├── eval │ │ │ ├── eval_binary.hxx │ │ │ ├── eval_conditional.hxx │ │ │ ├── eval_unary.hxx │ │ │ └── to_node_type.hxx │ │ ├── optimize.cxx │ │ ├── optimize.hxx │ │ ├── optimize_binary.cxx │ │ ├── optimize_declaration.cxx │ │ ├── optimize_expression.cxx │ │ ├── optimize_statement.cxx │ │ ├── optimize_ternary.cxx │ │ └── optimize_unary.cxx │ └── utils │ │ ├── CMakeLists.txt │ │ ├── Context.hxx │ │ ├── CustomLiteral.cxx │ │ ├── CustomLiteral.hxx │ │ ├── CustomResolver.cxx │ │ ├── CustomResolver.hxx │ │ ├── DefinitionTable.cxx │ │ ├── DefinitionTable.hxx │ │ ├── FunctionQueue.cxx │ │ ├── FunctionQueue.hxx │ │ ├── FunctionTable.hxx │ │ ├── GlobalTable.cxx │ │ ├── GlobalTable.hxx │ │ ├── MemberTable.cxx │ │ ├── MemberTable.hxx │ │ ├── SymbolTable.hxx │ │ ├── namespace_resolution.cxx │ │ └── namespace_resolution.hxx ├── assemble │ ├── CMakeLists.txt │ ├── assemble.cxx │ └── assemble.hxx ├── ast │ ├── AST.cxx │ ├── AST.hxx │ ├── CMakeLists.txt │ ├── Node.hxx │ ├── bind │ │ ├── Binding.hxx │ │ ├── CMakeLists.txt │ │ ├── Group.cxx │ │ ├── Group.hxx │ │ ├── NewVar.cxx │ │ └── NewVar.hxx │ ├── decl │ │ ├── CMakeLists.txt │ │ ├── Declaration.hxx │ │ ├── Definition.cxx │ │ ├── Definition.hxx │ │ ├── Enumeration.cxx │ │ ├── Enumeration.hxx │ │ ├── Function.cxx │ │ ├── Function.hxx │ │ ├── Global.cxx │ │ ├── Global.hxx │ │ ├── Static.cxx │ │ └── Static.hxx │ ├── expr │ │ ├── Array.cxx │ │ ├── Array.hxx │ │ ├── Binary.cxx │ │ ├── Binary.hxx │ │ ├── Bool.cxx │ │ ├── Bool.hxx │ │ ├── BuildIn.cxx │ │ ├── BuildIn.hxx │ │ ├── CMakeLists.txt │ │ ├── Call.cxx │ │ ├── Call.hxx │ │ ├── Char.cxx │ │ ├── Char.hxx │ │ ├── Choose.cxx │ │ ├── Choose.hxx │ │ ├── Conditional.cxx │ │ ├── Conditional.hxx │ │ ├── CustomLiteral.cxx │ │ ├── CustomLiteral.hxx │ │ ├── Expression.hxx │ │ ├── Float.cxx │ │ ├── Float.hxx │ │ ├── ForwardDynamicCall.cxx │ │ ├── ForwardDynamicCall.hxx │ │ ├── FxPointer.cxx │ │ ├── FxPointer.hxx │ │ ├── Iife.cxx │ │ ├── Iife.hxx │ │ ├── Index.cxx │ │ ├── Index.hxx │ │ ├── Integer.cxx │ │ ├── Integer.hxx │ │ ├── InvokeMember.cxx │ │ ├── InvokeMember.hxx │ │ ├── Lambda.cxx │ │ ├── Lambda.hxx │ │ ├── Map.cxx │ │ ├── Map.hxx │ │ ├── Member.cxx │ │ ├── Member.hxx │ │ ├── Null.cxx │ │ ├── Null.hxx │ │ ├── Reflect.cxx │ │ ├── Reflect.hxx │ │ ├── String.cxx │ │ ├── String.hxx │ │ ├── Struct.cxx │ │ ├── Struct.hxx │ │ ├── Ternary.cxx │ │ ├── Ternary.hxx │ │ ├── Tuple.cxx │ │ ├── Tuple.hxx │ │ ├── Unary.cxx │ │ ├── Unary.hxx │ │ ├── Var.cxx │ │ └── Var.hxx │ ├── stmt │ │ ├── Assign.cxx │ │ ├── Assign.hxx │ │ ├── Block.cxx │ │ ├── Block.hxx │ │ ├── CMakeLists.txt │ │ ├── Conditional.cxx │ │ ├── Conditional.hxx │ │ ├── ForEach.cxx │ │ ├── ForEach.hxx │ │ ├── IfElse.cxx │ │ ├── IfElse.hxx │ │ ├── InfiniteLoop.cxx │ │ ├── InfiniteLoop.hxx │ │ ├── NewVar.cxx │ │ ├── NewVar.hxx │ │ ├── NoOp.cxx │ │ ├── NoOp.hxx │ │ ├── Return.cxx │ │ ├── Return.hxx │ │ ├── Statement.hxx │ │ ├── StatementExpression.cxx │ │ ├── StatementExpression.hxx │ │ ├── Switch.cxx │ │ ├── Switch.hxx │ │ ├── Throw.cxx │ │ ├── Throw.hxx │ │ ├── While.cxx │ │ ├── While.hxx │ │ ├── Yield.cxx │ │ └── Yield.hxx │ ├── types.hxx │ └── util │ │ └── Conditional.hxx ├── compile │ ├── CMakeLists.txt │ ├── InstructionBuffer.hxx │ ├── build_in.cxx │ ├── build_in.hxx │ ├── compile.cxx │ ├── compile.hxx │ ├── compile_array.cxx │ ├── compile_binary.cxx │ ├── compile_block.cxx │ ├── compile_call.cxx │ ├── compile_co_return.cxx │ ├── compile_conditional.cxx │ ├── compile_expression.cxx │ ├── compile_function.cxx │ ├── compile_fx_ptr.cxx │ ├── compile_global.cxx │ ├── compile_if_else.cxx │ ├── compile_iife.cxx │ ├── compile_index.cxx │ ├── compile_init.cxx │ ├── compile_loops.cxx │ ├── compile_primitives.cxx │ ├── compile_read.cxx │ ├── compile_reflect.cxx │ ├── compile_return.cxx │ ├── compile_statement.cxx │ ├── compile_switch.cxx │ ├── compile_ternary.cxx │ ├── compile_throw.cxx │ ├── compile_type.cxx │ ├── compile_unary.cxx │ ├── compile_write.cxx │ ├── compile_yield.cxx │ ├── link │ │ ├── CMakeLists.txt │ │ ├── link.cxx │ │ └── link.hxx │ └── peephole │ │ ├── CMakeLists.txt │ │ ├── peephole.cxx │ │ └── peephole.hxx ├── inst │ ├── CMakeLists.txt │ ├── LinkInfo.hxx │ ├── args.hxx │ ├── inst.cxx │ └── inst.hxx ├── labels.cxx ├── labels.hxx ├── make_jump_id.cxx ├── make_jump_id.hxx ├── parse │ ├── BraceTracker.cxx │ ├── BraceTracker.hxx │ ├── CMakeLists.txt │ ├── parse.cxx │ ├── parse.hxx │ ├── parse_array.cxx │ ├── parse_assign.cxx │ ├── parse_binary.cxx │ ├── parse_block.cxx │ ├── parse_braces.cxx │ ├── parse_condition.cxx │ ├── parse_conditional.cxx │ ├── parse_definition.cxx │ ├── parse_enums.cxx │ ├── parse_expression.cxx │ ├── parse_function.cxx │ ├── parse_if_else.cxx │ ├── parse_loops.cxx │ ├── parse_member.cxx │ ├── parse_name.cxx │ ├── parse_newvar.cxx │ ├── parse_parenthesized.cxx │ ├── parse_primary.cxx │ ├── parse_reflect.cxx │ ├── parse_statement.cxx │ ├── parse_switch.cxx │ ├── parse_ternary.cxx │ ├── parse_unary.cxx │ ├── parse_utils.hxx │ ├── tokenize.cxx │ └── tokenize.hxx ├── print │ ├── CMakeLists.txt │ ├── print.cxx │ └── print.hxx ├── read_sources │ ├── CMakeLists.txt │ ├── read_sources.cxx │ └── read_sources.hxx ├── scoping │ ├── BlockScope.cxx │ ├── BlockScope.hxx │ ├── CMakeLists.txt │ ├── CaseScope.cxx │ ├── CaseScope.hxx │ ├── ExceptScope.cxx │ ├── ExceptScope.hxx │ ├── FunctionScope.cxx │ ├── FunctionScope.hxx │ ├── IifeScope.cxx │ ├── IifeScope.hxx │ ├── LocalScope.cxx │ ├── LocalScope.hxx │ ├── MajorScope.cxx │ ├── MajorScope.hxx │ ├── MinorScope.cxx │ ├── MinorScope.hxx │ ├── Scope.cxx │ ├── Scope.hxx │ ├── Variable.cxx │ └── Variable.hxx ├── source │ ├── CMakeLists.txt │ ├── FileSource.cxx │ ├── FileSource.hxx │ ├── ModuleSource.cxx │ ├── ModuleSource.hxx │ ├── Source.hxx │ ├── StringSource.cxx │ └── StringSource.hxx ├── sst │ ├── CMakeLists.txt │ ├── Node.hxx │ ├── SST.hxx │ ├── bind │ │ ├── Binding.hxx │ │ ├── CMakeLists.txt │ │ ├── Discard.cxx │ │ ├── Discard.hxx │ │ ├── Global.cxx │ │ ├── Global.hxx │ │ ├── Group.cxx │ │ ├── Group.hxx │ │ ├── Index.cxx │ │ ├── Index.hxx │ │ ├── Local.cxx │ │ ├── Local.hxx │ │ ├── Member.cxx │ │ ├── Member.hxx │ │ ├── NewVar.cxx │ │ └── NewVar.hxx │ ├── decl │ │ ├── CMakeLists.txt │ │ ├── Declaration.hxx │ │ ├── Definition.cxx │ │ ├── Definition.hxx │ │ ├── Function.cxx │ │ ├── Function.hxx │ │ ├── Global.cxx │ │ ├── Global.hxx │ │ ├── Static.cxx │ │ └── Static.hxx │ ├── expr │ │ ├── Array.cxx │ │ ├── Array.hxx │ │ ├── Binary.cxx │ │ ├── Binary.hxx │ │ ├── BuildIn.cxx │ │ ├── BuildIn.hxx │ │ ├── CMakeLists.txt │ │ ├── Call.cxx │ │ ├── Call.hxx │ │ ├── Conditional.cxx │ │ ├── Conditional.hxx │ │ ├── Expression.cxx │ │ ├── Expression.hxx │ │ ├── FxPointer.cxx │ │ ├── FxPointer.hxx │ │ ├── GlobalVar.cxx │ │ ├── GlobalVar.hxx │ │ ├── Iife.cxx │ │ ├── Iife.hxx │ │ ├── Index.cxx │ │ ├── Index.hxx │ │ ├── Invoke.cxx │ │ ├── Invoke.hxx │ │ ├── InvokeMember.cxx │ │ ├── InvokeMember.hxx │ │ ├── Literal.cxx │ │ ├── Literal.hxx │ │ ├── Map.cxx │ │ ├── Map.hxx │ │ ├── Member.cxx │ │ ├── Member.hxx │ │ ├── Reflect.cxx │ │ ├── Reflect.hxx │ │ ├── Struct.cxx │ │ ├── Struct.hxx │ │ ├── Switch.cxx │ │ ├── Switch.hxx │ │ ├── Ternary.cxx │ │ ├── Ternary.hxx │ │ ├── Tuple.cxx │ │ ├── Tuple.hxx │ │ ├── Unary.cxx │ │ ├── Unary.hxx │ │ ├── Var.cxx │ │ └── Var.hxx │ ├── misc │ │ ├── CMakeLists.txt │ │ ├── Except.cxx │ │ └── Except.hxx │ ├── stmt │ │ ├── Assign.cxx │ │ ├── Assign.hxx │ │ ├── Block.cxx │ │ ├── Block.hxx │ │ ├── CMakeLists.txt │ │ ├── CoReturn.cxx │ │ ├── CoReturn.hxx │ │ ├── Conditional.cxx │ │ ├── Conditional.hxx │ │ ├── ForEach.cxx │ │ ├── ForEach.hxx │ │ ├── IfElse.cxx │ │ ├── IfElse.hxx │ │ ├── InfiniteLoop.cxx │ │ ├── InfiniteLoop.hxx │ │ ├── NoOp.cxx │ │ ├── NoOp.hxx │ │ ├── Return.cxx │ │ ├── Return.hxx │ │ ├── Statement.hxx │ │ ├── Switch.cxx │ │ ├── Switch.hxx │ │ ├── Throw.cxx │ │ ├── Throw.hxx │ │ ├── While.cxx │ │ ├── While.hxx │ │ ├── Yield.cxx │ │ └── Yield.hxx │ ├── types.hxx │ └── util │ │ └── Conditional.hxx └── tokens │ ├── CMakeLists.txt │ ├── Token.cxx │ └── Token.hxx ├── litan_core ├── Any.cxx ├── Any.hxx ├── CMakeLists.txt ├── Visitor.hxx ├── args.hxx ├── casts.hxx ├── cxx_types.hxx ├── file │ ├── CMakeLists.txt │ ├── FunctionPool.cxx │ ├── FunctionPool.hxx │ ├── MemberNameTable.cxx │ ├── MemberNameTable.hxx │ ├── StaticPool.cxx │ ├── StaticPool.hxx │ ├── StringPool.cxx │ ├── StringPool.hxx │ └── binary.hxx ├── fxcodes.hxx ├── header.hxx ├── opcodes.hxx ├── reserved_members.cxx ├── reserved_members.hxx ├── type_code.hxx ├── unique.hxx ├── utf8.cxx ├── utf8.hxx └── version.hxx ├── litan_native ├── CMakeLists.txt ├── Value.h ├── context.h ├── litan.h ├── plugin.h └── types.h ├── litan_stdlib ├── CMakeLists.txt ├── algorithm.ltn ├── bits.ltn ├── chrono.ltn ├── container.ltn ├── functional.ltn ├── io.ltn ├── iter.ltn ├── json.ltn ├── litan_stdlib.h ├── math.ltn ├── misc.ltn ├── random.ltn ├── string.ltn └── type.ltn ├── litan_vm ├── CMakeLists.txt ├── Exception.hxx ├── Heap.cxx ├── Heap.hxx ├── VM.cxx ├── VM.hxx ├── VMCore.hxx ├── VMStack.cxx ├── VMStack.hxx ├── Value.hxx ├── external │ ├── CMakeLists.txt │ ├── Callable.hxx │ ├── Parameters.cxx │ ├── Parameters.hxx │ └── wrap_return.hxx ├── gc.cxx ├── gc.hxx ├── inst │ ├── CMakeLists.txt │ ├── inst_alloc.cxx │ ├── inst_arithmetic.cxx │ ├── inst_at.cxx │ ├── inst_at_write.cxx │ ├── inst_bitwise.cxx │ ├── inst_build_in.cxx │ ├── inst_capture.cxx │ ├── inst_casts.cxx │ ├── inst_compare.cxx │ ├── inst_control_flow.cxx │ ├── inst_debug.cxx │ ├── inst_deref.cxx │ ├── inst_invoke.cxx │ ├── inst_iter.cxx │ ├── inst_memory.cxx │ ├── inst_static.cxx │ ├── inst_struct.cxx │ ├── inst_unary.cxx │ ├── inst_unpack.cxx │ ├── inst_values.cxx │ ├── inst_yield.cxx │ └── instructions.hxx ├── litan_vm.cxx ├── litan_vm.hxx ├── native │ ├── CMakeLists.txt │ ├── NativeCore.hxx │ ├── native.cxx │ └── native.hxx ├── objects │ ├── CMakeLists.txt │ ├── Clock.cxx │ ├── Clock.hxx │ ├── Coroutine.cxx │ ├── Coroutine.hxx │ ├── FunctionPointer.cxx │ ├── FunctionPointer.hxx │ ├── NativeFunctionPointer.cxx │ ├── NativeFunctionPointer.hxx │ ├── Object.cxx │ ├── Object.hxx │ ├── Plugin.cxx │ ├── Plugin.hxx │ ├── RandomEngine.cxx │ ├── RandomEngine.hxx │ ├── ScriptFunctionPointer.hxx │ ├── StaticObject.hxx │ ├── container.hxx │ ├── container │ │ ├── Array.cxx │ │ ├── Array.hxx │ │ ├── CMakeLists.txt │ │ ├── Container.hxx │ │ ├── Contiguous.hxx │ │ ├── Map.cxx │ │ ├── Map.hxx │ │ ├── Queue.cxx │ │ ├── Queue.hxx │ │ ├── Segmented.hxx │ │ ├── Stack.cxx │ │ ├── Stack.hxx │ │ ├── String.cxx │ │ ├── String.hxx │ │ ├── Struct.cxx │ │ ├── Struct.hxx │ │ ├── Tuple.cxx │ │ └── Tuple.hxx │ ├── io.hxx │ ├── io │ │ ├── CMakeLists.txt │ │ ├── IStream.cxx │ │ ├── IStream.hxx │ │ ├── OStream.cxx │ │ └── OStream.hxx │ ├── iter.hxx │ ├── iter │ │ ├── CMakeLists.txt │ │ ├── CombinedIterator.cxx │ │ ├── CombinedIterator.hxx │ │ ├── ContiguousIterator.cxx │ │ ├── ContiguousIterator.hxx │ │ ├── CoroutineIterator.cxx │ │ ├── CoroutineIterator.hxx │ │ ├── Iterator.cxx │ │ ├── Iterator.hxx │ │ ├── MapIterator.cxx │ │ ├── MapIterator.hxx │ │ ├── RangeIterator.cxx │ │ ├── RangeIterator.hxx │ │ ├── ReversedIterator.cxx │ │ ├── ReversedIterator.hxx │ │ ├── StringIterator.cxx │ │ └── StringIterator.hxx │ ├── objects.hxx │ └── types │ │ ├── ArrayType.cxx │ │ ├── ArrayType.hxx │ │ ├── BoolType.cxx │ │ ├── BoolType.hxx │ │ ├── CMakeLists.txt │ │ ├── ClockType.cxx │ │ ├── ClockType.hxx │ │ ├── CoroutineType.cxx │ │ ├── CoroutineType.hxx │ │ ├── FloatType.cxx │ │ ├── FloatType.hxx │ │ ├── FunctionType.cxx │ │ ├── FunctionType.hxx │ │ ├── IStreamType.cxx │ │ ├── IStreamType.hxx │ │ ├── IntType.cxx │ │ ├── IntType.hxx │ │ ├── IteratorType.cxx │ │ ├── IteratorType.hxx │ │ ├── MapType.cxx │ │ ├── MapType.hxx │ │ ├── NullType.cxx │ │ ├── NullType.hxx │ │ ├── OStreamType.cxx │ │ ├── OStreamType.hxx │ │ ├── QueueType.cxx │ │ ├── QueueType.hxx │ │ ├── RandomEngineType.cxx │ │ ├── RandomEngineType.hxx │ │ ├── StackType.cxx │ │ ├── StackType.hxx │ │ ├── StopType.cxx │ │ ├── StopType.hxx │ │ ├── StringType.cxx │ │ ├── StringType.hxx │ │ ├── StructType.cxx │ │ ├── StructType.hxx │ │ ├── TupleType.cxx │ │ ├── TupleType.hxx │ │ ├── TypeObject.hxx │ │ ├── TypeType.cxx │ │ └── TypeType.hxx ├── plugin │ ├── CMakeLists.txt │ ├── callbacks.cxx │ └── callbacks.hxx ├── stdlib │ ├── CMakeLists.txt │ ├── algorithm.cxx │ ├── algorithm.hxx │ ├── array.cxx │ ├── array.hxx │ ├── bool.cxx │ ├── bool.hxx │ ├── chrono.cxx │ ├── chrono.hxx │ ├── container.cxx │ ├── container.hxx │ ├── float.cxx │ ├── float.hxx │ ├── functional.cxx │ ├── functional.hxx │ ├── int.cxx │ ├── int.hxx │ ├── io.cxx │ ├── io.hxx │ ├── iter.cxx │ ├── iter.hxx │ ├── json.cxx │ ├── json.hxx │ ├── map.cxx │ ├── map.hxx │ ├── math.cxx │ ├── math.hxx │ ├── misc.cxx │ ├── misc.hxx │ ├── null.cxx │ ├── null.hxx │ ├── plugin.cxx │ ├── plugin.hxx │ ├── queue.cxx │ ├── queue.hxx │ ├── random.cxx │ ├── random.hxx │ ├── stack.cxx │ ├── stack.hxx │ ├── string.cxx │ ├── string.hxx │ ├── struct.cxx │ ├── struct.hxx │ ├── tuple.cxx │ ├── tuple.hxx │ ├── type.cxx │ └── type.hxx └── utils │ ├── CMakeLists.txt │ ├── GCLock.cxx │ ├── GCLock.hxx │ ├── calc_binary.hxx │ ├── cast.cxx │ ├── cast.hxx │ ├── compare.cxx │ ├── compare.hxx │ ├── container.cxx │ ├── container.hxx │ ├── convert.cxx │ ├── convert.hxx │ ├── function.cxx │ ├── function.hxx │ ├── index.hxx │ ├── json.cxx │ ├── json.hxx │ ├── special_member.hxx │ ├── stringify.cxx │ ├── stringify.hxx │ ├── to_any.cxx │ ├── to_any.hxx │ ├── to_value.cxx │ ├── to_value.hxx │ └── type_check.hxx ├── run_tests.sh ├── sandbox ├── double_loop.ltn ├── double_loop.txt └── misc.ltn ├── test ├── core │ ├── __module__.ltn │ ├── assign.ltn │ ├── block.ltn │ ├── cofunction.ltn │ ├── colambda.ltn │ ├── conditional_expr.ltn │ ├── conditional_stmt.ltn │ ├── coroutine.ltn │ ├── coroutine_iteration.ltn │ ├── datatypes │ │ ├── __module__.ltn │ │ ├── array.ltn │ │ ├── function.ltn │ │ ├── map.ltn │ │ ├── queue.ltn │ │ ├── stack.ltn │ │ ├── string.ltn │ │ └── tuple.ltn │ ├── define.ltn │ ├── for.ltn │ ├── function_pointers.ltn │ ├── global.ltn │ ├── if_else.ltn │ ├── iife.ltn │ ├── invoke_member.ltn │ ├── lambda.ltn │ ├── literals.ltn │ ├── map.ltn │ ├── op_arith_add.ltn │ ├── op_arith_div.ltn │ ├── op_arith_mlt.ltn │ ├── op_arith_mod.ltn │ ├── op_arith_pow.ltn │ ├── op_arith_sub.ltn │ ├── op_bit_and.ltn │ ├── op_bit_not.ltn │ ├── op_bit_or.ltn │ ├── op_bit_shift_l.ltn │ ├── op_bit_shift_r.ltn │ ├── op_bit_xor.ltn │ ├── op_comp_eql.ltn │ ├── op_comp_greater.ltn │ ├── op_comp_greater_eql.ltn │ ├── op_comp_less.ltn │ ├── op_comp_less_eql.ltn │ ├── op_comp_spaceship.ltn │ ├── op_comp_ueql.ltn │ ├── op_elvis.ltn │ ├── op_index.ltn │ ├── op_logic_and.ltn │ ├── op_logic_not.ltn │ ├── op_logic_or.ltn │ ├── op_neg.ltn │ ├── op_nullco.ltn │ ├── op_nulltest.ltn │ ├── op_ternary.ltn │ ├── reflect_function.ltn │ ├── reflect_location.ltn │ ├── reflect_namespace.ltn │ ├── s_bind_for.ltn │ ├── s_bind_var.ltn │ ├── special_members.ltn │ ├── struct.ltn │ ├── switch_expr.ltn │ ├── switch_stmt.ltn │ ├── tco.ltn │ ├── throw.ltn │ ├── tuple.ltn │ ├── var.ltn │ ├── variadic.ltn │ └── while.ltn ├── files │ ├── 1.txt │ └── dummy.txt ├── import_file.ltn ├── main.ltn ├── plugin │ ├── __module__.ltn │ ├── as_type.ltn │ ├── is_type.ltn │ └── plugin.ltn ├── std │ ├── __module__.ltn │ ├── algorithm │ │ ├── __module__.ltn │ │ ├── fill.ltn │ │ ├── find.ltn │ │ ├── for_each.ltn │ │ ├── is_sorted_ascn.ltn │ │ ├── is_sorted_desc.ltn │ │ ├── reduce_l.ltn │ │ ├── reduce_r.ltn │ │ ├── reverse.ltn │ │ ├── sort_ascn.ltn │ │ ├── sort_desc.ltn │ │ ├── sum.ltn │ │ ├── transform.ltn │ │ └── zip.ltn │ ├── arity.ltn │ ├── bits_get.ltn │ ├── bits_set.ltn │ ├── container │ │ ├── __module__.ltn │ │ ├── at.ltn │ │ ├── back.ltn │ │ ├── contains.ltn │ │ ├── empty.ltn │ │ ├── front.ltn │ │ ├── insert.ltn │ │ ├── peek.ltn │ │ ├── pop.ltn │ │ ├── push.ltn │ │ ├── remove.ltn │ │ └── size.ltn │ ├── functional │ │ ├── __module__.ltn │ │ ├── arity.ltn │ │ ├── chain.ltn │ │ ├── invoke.ltn │ │ ├── is_successful.ltn │ │ └── is_variadic.ltn │ ├── io │ │ ├── __module__.ltn │ │ ├── is_eof.ltn │ │ ├── read.ltn │ │ ├── read_all.ltn │ │ ├── read_bool.ltn │ │ ├── read_char.ltn │ │ ├── read_float.ltn │ │ ├── read_int.ltn │ │ ├── readln.ltn │ │ └── utils.ltn │ ├── is_type.ltn │ ├── iter │ │ ├── __module__.ltn │ │ ├── array.ltn │ │ ├── map.ltn │ │ ├── range.ltn │ │ ├── reversed.ltn │ │ ├── string.ltn │ │ ├── tuple.ltn │ │ ├── utils.ltn │ │ └── zipped.ltn │ ├── json │ │ ├── __module__.ltn │ │ ├── parse.ltn │ │ └── print.ltn │ ├── math │ │ ├── __module__.ltn │ │ ├── abs.ltn │ │ ├── cbrt.ltn │ │ ├── ceil.ltn │ │ ├── clamp.ltn │ │ ├── cos.ltn │ │ ├── floor.ltn │ │ ├── hypot.ltn │ │ ├── is_between.ltn │ │ ├── ld.ltn │ │ ├── lerp.ltn │ │ ├── lg.ltn │ │ ├── ln.ltn │ │ ├── log.ltn │ │ ├── max.ltn │ │ ├── min.ltn │ │ ├── pi.ltn │ │ ├── pow.ltn │ │ ├── round.ltn │ │ ├── sin.ltn │ │ ├── sqrt.ltn │ │ └── tan.ltn │ ├── string │ │ ├── __module__.ltn │ │ ├── chr.ltn │ │ ├── join.ltn │ │ ├── ord.ltn │ │ ├── replace.ltn │ │ ├── split.ltn │ │ └── str.ltn │ └── type │ │ ├── __module__.ltn │ │ ├── cast.ltn │ │ ├── has_special_.ltn │ │ ├── is.ltn │ │ ├── match_type.ltn │ │ ├── mono.ltn │ │ └── pair.ltn └── test_plugin │ ├── CMakeLists.txt │ ├── as_type.c │ ├── as_type.h │ ├── is_type.c │ ├── is_type.h │ └── test_plugin.c └── tools ├── CMakeLists.txt └── embed_file.cxx /.gitattributes: -------------------------------------------------------------------------------- 1 | 2 | *.ltn linguist-detectable=true 3 | *.ltn linguist-language=text 4 | *.asm.ltn linguist-detectable=false 5 | *.bin.ltn linguist-detectable=false 6 | 7 | * text eol=lf 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | .vscode 4 | /bin 5 | /tmp 6 | /build 7 | .VSCodeCounter 8 | *.asm.ltn 9 | *.bin.ltn 10 | *.drawio.bkp 11 | *.drawio.dtmp -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test/sphinx"] 2 | path = test/sphinx 3 | url = https://github.com/JeneLitsch/Sphinx.git 4 | [submodule "libs/stdxx"] 5 | path = libs/stdxx 6 | url = https://github.com/JeneLitsch/stdxx.git 7 | -------------------------------------------------------------------------------- /benchmark/array.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | var clock = std::chrono::clock(); 3 | for (i : std::range(0, 1000000)) { 4 | var a = [1,2,3,4,5,6,7,8,9]; 5 | } 6 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 7 | } -------------------------------------------------------------------------------- /benchmark/call.ltn: -------------------------------------------------------------------------------- 1 | function f(a, b, c) { 2 | 3 | } 4 | 5 | function main() { 6 | var clock = std::chrono::clock(); 7 | for (i : std::range(0, 5000000)) f(1, 2, 3); 8 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 9 | } -------------------------------------------------------------------------------- /benchmark/fx_capture_lambda.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | var a = 42; 3 | var fx_ptr = lambda[a]() => null; 4 | var clock = std::chrono::clock(); 5 | for (i : std::range(0, 5000000)) fx_ptr(); 6 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 7 | } -------------------------------------------------------------------------------- /benchmark/fx_empty_lambda.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | var fx_ptr = lambda() => null; 3 | var clock = std::chrono::clock(); 4 | for (i : std::range(0, 5000000)) fx_ptr(); 5 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 6 | } -------------------------------------------------------------------------------- /benchmark/fx_pointer.ltn: -------------------------------------------------------------------------------- 1 | function f() {} 2 | 3 | function main() { 4 | var fx_ptr = &f(); 5 | var clock = std::chrono::clock(); 6 | for (i : std::range(0, 5000000)) fx_ptr(); 7 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 8 | } -------------------------------------------------------------------------------- /benchmark/member.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | var clock = std::chrono::clock(); 3 | var foo = std::struct(); 4 | foo.a = 0; 5 | for (i : std::range(0, 1000000)) { 6 | foo.b = 1; 7 | foo.b = null; 8 | foo.a = foo.a + 1; 9 | } 10 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 11 | } -------------------------------------------------------------------------------- /benchmark/memory.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | var clock = std::chrono::clock(); 3 | var x = 42; 4 | for (i : std::range(0, 10000000)) { 5 | var y = x; 6 | } 7 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 8 | } -------------------------------------------------------------------------------- /benchmark/range.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | var clock = std::chrono::clock(); 3 | var array = [1,2,3,4]; 4 | for (i : std::range(0, 100000)) { 5 | std::sum(array); 6 | } 7 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 8 | } -------------------------------------------------------------------------------- /benchmark/run.sh: -------------------------------------------------------------------------------- 1 | run () { 2 | echo "Benchmarking \"$1\"" 3 | ./bin/ltn --src benchmark/$1.ltn 4 | echo 5 | } 6 | 7 | # run () { 8 | # echo "Benchmarking \"$1\"" 9 | # ltnFile="benchmark/$1.ltn" 10 | # asmFile="benchmark/$1.asm.ltn" 11 | # binFile="benchmark/$1.bin.ltn" 12 | # ./bin/ltnc --exe $binFile --src $ltnFile 13 | # ./bin/ltnvm --exe $binFile 14 | # echo 15 | # } 16 | 17 | run "switch" 18 | # run "array" 19 | # run "string" 20 | # run "memory" 21 | # run "call" 22 | # run "member" 23 | # run "range" 24 | echo 25 | echo -------------------------------------------------------------------------------- /benchmark/run_fx.sh: -------------------------------------------------------------------------------- 1 | run () { 2 | echo "Benchmarking \"$1\"" 3 | ./bin/ltn --src benchmark/$1.ltn 4 | echo 5 | } 6 | 7 | # run () { 8 | # echo "Benchmarking \"$1\"" 9 | # ltnFile="benchmark/$1.ltn" 10 | # asmFile="benchmark/$1.asm.ltn" 11 | # binFile="benchmark/$1.bin.ltn" 12 | # ./bin/ltnc --exe $binFile --src $ltnFile 13 | # ./bin/ltnvm --exe $binFile 14 | # echo 15 | # } 16 | 17 | run "fx_pointer" 18 | run "fx_empty_lambda" 19 | run "fx_capture_lambda" 20 | echo 21 | echo -------------------------------------------------------------------------------- /benchmark/run_o.sh: -------------------------------------------------------------------------------- 1 | run () { 2 | echo "Benchmarking \"$1\"" 3 | ./bin/ltn -o --src benchmark/$1.ltn 4 | echo 5 | } 6 | 7 | 8 | # run () { 9 | # echo "Benchmarking \"$1\"" 10 | # ltnFile="benchmark/$1.ltn" 11 | # asmFile="benchmark/$1.asm.ltn" 12 | # binFile="benchmark/$1.bin.ltn" 13 | # ./bin/ltnc -o --exe $binFile --src $ltnFile 14 | # ./bin/ltnvm --exe $binFile 15 | # echo 16 | # } 17 | 18 | run "array" 19 | run "string" 20 | run "memory" 21 | run "call" 22 | run "member" 23 | run "range" -------------------------------------------------------------------------------- /benchmark/string.ltn: -------------------------------------------------------------------------------- 1 | function main(){ 2 | var clock = std::chrono::clock(); 3 | for (i : std::range(0, 1000000)) { 4 | var x = "A" + "BBBB" + "CCCCCCCC"; 5 | } 6 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 7 | // std::println(std::debug::state()); 8 | } -------------------------------------------------------------------------------- /benchmark/switch.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | var clock = std::chrono::clock(); 3 | for(i : std::range(0, 1000000)) { 4 | switch(i%3) { 5 | case 0 => {}; 6 | case 1 => {}; 7 | default => {}; 8 | } 9 | } 10 | std::println(std::str(std::chrono::to_seconds(clock)) + "s"); 11 | } -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | cmake . -D CMAKE_CXX_COMPILER=${1:-clang++} -B build -S . 2 | cmake --build build -j8 3 | cp build/test/test_plugin/libtest_plugin.so bin/ -------------------------------------------------------------------------------- /clear.sh: -------------------------------------------------------------------------------- 1 | rm -r ./bin 2 | rm -r ./build -------------------------------------------------------------------------------- /diagnostics/error/assign.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | var a : int = 42.42; // Cannot assign float to int 3 | } -------------------------------------------------------------------------------- /diagnostics/error/binary_add.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | [] + ""; // Invalid operands 3 | 1 + []; // Invalid operands 4 | null + null; // Invalid operands 5 | } -------------------------------------------------------------------------------- /diagnostics/error/unary_neg.ltn: -------------------------------------------------------------------------------- 1 | function main() => -[] // Invalid operands -------------------------------------------------------------------------------- /diagnostics/run.sh: -------------------------------------------------------------------------------- 1 | echo "=== Errors ===" 2 | echo 3 | 4 | bin/ltnc --src diagnostics/error/assign.ltn 5 | bin/ltnc --src diagnostics/error/unary_neg.ltn 6 | bin/ltnc --src diagnostics/error/binary_add.ltn 7 | 8 | echo "=== Warnings ===" 9 | echo "TODO" 10 | -------------------------------------------------------------------------------- /doc/c_api/string.md: -------------------------------------------------------------------------------- 1 | # C API - String 2 | 3 | Operations: 4 | 5 | - `ltn_string_data` 6 | - `ltn_string_size` 7 | 8 | ## ltn_string_data 9 | 10 | `const char * ltn_string_data(ltn_String string)` 11 | 12 | Returns the underlying character array of string. 13 | 14 | ## ltn_string_size 15 | 16 | `const char * ltn_string_size(ltn_String string)` 17 | 18 | Returns the size of the string in bytes. -------------------------------------------------------------------------------- /doc/c_api/tuple.md: -------------------------------------------------------------------------------- 1 | # C API - Tuple 2 | 3 | Operations: 4 | 5 | - `ltn_tuple_at` 6 | - `ltn_tuple_size` 7 | 8 | 9 | 10 | ## ltn_tuple_at 11 | 12 | `ltn_Value ltn_tuple_at(ltn_Tuple tuple, ltn_Int index)` 13 | 14 | 15 | ## ltn_tuple_size 16 | 17 | `ltn_Int ltn_tuple_size(ltn_Tuple tuple)` 18 | 19 | Returns the size of the `tuple`. -------------------------------------------------------------------------------- /doc/language/Defines.md: -------------------------------------------------------------------------------- 1 | # Define 2 | Defines are used to declare global constants. Function calls are not allowed in defines. Global variables cannot be used. 3 | 4 | ```javascript 5 | namespace my_namespace { 6 | def foo = "Hello World"; 7 | def bar = 42; 8 | } 9 | 10 | function main() { 11 | std::println(my_namespace::foo); 12 | std::println(my_namespace::bar); 13 | } 14 | ``` 15 | 16 | The output is 17 | ``` 18 | Hello World 19 | 42 20 | ``` -------------------------------------------------------------------------------- /doc/language/Enums.md: -------------------------------------------------------------------------------- 1 | # Enums 2 | 3 | ```js 4 | enum my_enum { 5 | FOO; 6 | BAR : 5; 7 | BAZ; 8 | } 9 | ``` 10 | 11 | ```js 12 | function main() { 13 | std::println(my_enum::FOO); 14 | std::println(my_enum::BAR); 15 | std::println(my_enum::BAZ); 16 | } 17 | ``` 18 | All three values are plain integers. 19 | 20 | 21 | The output is 22 | ``` 23 | 0 24 | 5 25 | 6 26 | ``` -------------------------------------------------------------------------------- /doc/language/IterationInvalidation.md: -------------------------------------------------------------------------------- 1 | # Iterator Invalidation 2 | 3 | Adding or removing elements from a container invalidates iterators pointing into that container. 4 | If a invalidated iterator is used an exception in thrown. 5 | 6 | Currently these containers are affected 7 | 8 | - Map 9 | - String 10 | - Array 11 | - Tuple -------------------------------------------------------------------------------- /doc/language/MemberFunction.md: -------------------------------------------------------------------------------- 1 | # Member function 2 | 3 | Any function added to a struct can be used as a member function. 4 | The struct is always passed as the first argument. 5 | 6 | ## Call/Invocation Syntax 7 | 8 | ```js 9 | foo->bar(/*other arguments*/); 10 | ``` 11 | -------------------------------------------------------------------------------- /doc/language/Reflection.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JeneLitsch/Litan/2c68fcc51c33e3bffe96fe7cd07fba0decdb12a2/doc/language/Reflection.md -------------------------------------------------------------------------------- /doc/language/TypeCategories.md: -------------------------------------------------------------------------------- 1 | # Type Categories 2 | 3 | ## Subint 4 | Subint types hold integer-like values but are smaller than int. 5 | Subint types are: 6 | - bool 7 | 8 | ## Integral 9 | Integral types hold integer-like values. 10 | Integral types are: 11 | - bool 12 | - int 13 | 14 | ## Numeric 15 | Numeric types hold either integral or real values. 16 | Any integral type is also a numeric type. 17 | Numeric types are: 18 | - bool 19 | - int 20 | - float 21 | -------------------------------------------------------------------------------- /doc/stdlib/algorithm/fill.md: -------------------------------------------------------------------------------- 1 | # std::fill 2 | 3 | ## std::fill(range, value) 4 | 5 | **Parameters:** 6 | * range: A range or an array 7 | * value: An arbitrary value 8 | 9 | **Return value:** 10 | null 11 | 12 | **Description:** 13 | Fills the range with value. 14 | 15 | -------------------------------------------------------------------------------- /doc/stdlib/algorithm/find.md: -------------------------------------------------------------------------------- 1 | # std::find 2 | 3 | ## std::fill(range, value) 4 | 5 | **Parameters:** 6 | * range: A range or an array 7 | * value: An arbitrary value 8 | 9 | **Return value:** 10 | optional<int> 11 | 12 | **Description:** 13 | Finds the first occurrence in the range. 14 | Returns the index of the element or null if no matching element is present. 15 | -------------------------------------------------------------------------------- /doc/stdlib/algorithm/for_each.md: -------------------------------------------------------------------------------- 1 | # std::for_each 2 | 3 | ## std::for_each(range, fx) 4 | 5 | **Parameters:** 6 | * range: array or tuple 7 | * fx: Callable type which takes one parameter. 8 | 9 | **Return value:** 10 | Always returns null. 11 | 12 | **Description:** 13 | Calls fx for every element in the passed range. -------------------------------------------------------------------------------- /doc/stdlib/algorithm/is_sorted.md: -------------------------------------------------------------------------------- 1 | # std::is_sorted_* 2 | 3 | ## std::is_sorted_ascn(range) const 4 | **Parameters:** 5 | * range: A range or an array 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Checks if a range or an array is sorted in ascending order. 12 | 13 | --- 14 | 15 | 16 | 17 | ## std::is_sorted_desc(range) const 18 | **Parameters:** 19 | * range: A range or an array 20 | 21 | **Return value:** 22 | bool 23 | 24 | **Description:** 25 | Checks if a range or an array is sorted in descending order. 26 | -------------------------------------------------------------------------------- /doc/stdlib/algorithm/reverse.md: -------------------------------------------------------------------------------- 1 | # std::reverse 2 | 3 | ## std::reverse(range) 4 | **Parameters:** 5 | * range: an array 6 | 7 | **Return value:** 8 | null 9 | 10 | **Description:** 11 | Reverses the order of all elements in the range. 12 | -------------------------------------------------------------------------------- /doc/stdlib/algorithm/sum.md: -------------------------------------------------------------------------------- 1 | # std::sum 2 | 3 | ## std::sum(range, start) 4 | **Parameters:** 5 | * range: a tuple or array 6 | * start: Start value to add to 7 | 8 | **Return value:** 9 | The calculated sum 10 | 11 | **Description:** 12 | Adds all elements to start. 13 | 14 | --- 15 | 16 | 17 | 18 | ## std::sum(range) 19 | **Parameters:** 20 | * range: a tuple or array 21 | 22 | **Return value:** 23 | The calculated sum 24 | 25 | **Description:** 26 | Starts with 0 and sums up all elements in the range. 27 | 28 | --- -------------------------------------------------------------------------------- /doc/stdlib/algorithm/transform.md: -------------------------------------------------------------------------------- 1 | # std::transform 2 | 3 | ## std::transform(in, fx) 4 | **Parameters:** 5 | * range: A iterable object 6 | * fx: unary function 7 | 8 | **Return value:** 9 | array 10 | 11 | **Description:** 12 | Applies fx to all elements of range and returns an array of the results. 13 | -------------------------------------------------------------------------------- /doc/stdlib/algorithm/zip.md: -------------------------------------------------------------------------------- 1 | # std::zip 2 | 3 | ## std::zip(ranges) 4 | **Parameters:** 5 | * ranges: Tuple of iterable objects 6 | 7 | **Return value:** 8 | array(tuple(...)) 9 | 10 | **Description:** 11 | Zips -------------------------------------------------------------------------------- /doc/stdlib/bits/get.md: -------------------------------------------------------------------------------- 1 | # std::bits::get 2 | 3 | ## std::bits::get(number, index) 4 | **Parameters:** 5 | - number: a single integer 6 | - index: an integer index 7 | 8 | **Return value:** 9 | bool 10 | 11 | **Description:** 12 | Returns the bit of number at position index as an boolean. -------------------------------------------------------------------------------- /doc/stdlib/bits/set.md: -------------------------------------------------------------------------------- 1 | # std::bits::set 2 | 3 | ## std::bits::set(number, index, value) 4 | **Parameters:** 5 | - number: an integer 6 | - index: an integer index 7 | - value: boolean value for the bit to set. 8 | 9 | **Return value:** 10 | single int with bit set to value 11 | 12 | **Description:** 13 | Sets the bit at position index. A new and changed int is returned. -------------------------------------------------------------------------------- /doc/stdlib/call_stack_depth.md: -------------------------------------------------------------------------------- 1 | # std::call_stack_depth 2 | 3 | ## std::call_stack_depth(): Int const 4 | 5 | **Descriptions:** 6 | Returns the number of frames on the stack. 7 | The number may be lower than expected due to optimization. -------------------------------------------------------------------------------- /doc/stdlib/chrono/clock.md: -------------------------------------------------------------------------------- 1 | # std::chrono::clock 2 | 3 | ## std::chrono::clock() 4 | 5 | **Return value:** 6 | Returns a new clock 7 | 8 | **Description:** 9 | Creates a new Clock. -------------------------------------------------------------------------------- /doc/stdlib/chrono/to_milliseconds.md: -------------------------------------------------------------------------------- 1 | # std::chrono::to_milliseconds 2 | 3 | ## std::chrono::to_milliseconds(clock) 4 | **Parameters:** 5 | * clock: A Clock 6 | 7 | **Return value:** 8 | Milliseconds as Float 9 | 10 | **Description:** 11 | Gets the passed time of the Clock since its creation 12 | -------------------------------------------------------------------------------- /doc/stdlib/chrono/to_seconds.md: -------------------------------------------------------------------------------- 1 | # std::chrono::to_*seconds 2 | 3 | ## std::chrono::to_seconds(clock) 4 | **Parameters:** 5 | * clock: A Clock 6 | 7 | **Return value:** 8 | Seconds as Float 9 | 10 | **Description:** 11 | Gets the passed time of the Clock since its creation 12 | -------------------------------------------------------------------------------- /doc/stdlib/chrono/wait.md: -------------------------------------------------------------------------------- 1 | # std::chrono::wait 2 | 3 | ## std::chrono::wait(seconds) 4 | **Parameters:** 5 | - seconds: seconds as Int or Float 6 | 7 | **Return value:** 8 | null 9 | 10 | **Description:** 11 | Waits for a given amount of time. 12 | 13 | --- 14 | 15 | ## std::chrono::wait(seconds, clock) 16 | **Parameters:** 17 | - seconds: seconds as Int or Float 18 | - clock: a Clock 19 | 20 | **Return value:** 21 | null 22 | 23 | **Description:** 24 | Waits for a given amount of time. Uses passed Clock instead of a default constructed one. -------------------------------------------------------------------------------- /doc/stdlib/container/array.md: -------------------------------------------------------------------------------- 1 | # std::array 2 | 3 | ## std::array() 4 | 5 | **Return value:** 6 | Reference to a new Array 7 | 8 | **Description:** 9 | Creates a new and empty Array -------------------------------------------------------------------------------- /doc/stdlib/container/at.md: -------------------------------------------------------------------------------- 1 | # std::at 2 | 3 | ## std::at(collection, index) 4 | * collection: Any indexable object 5 | * index: index or key 6 | 7 | **Return value:** 8 | Element from the collection. 9 | 10 | **Description:** 11 | Return the element at index or key. 12 | The function works with arrays, strings and maps. -------------------------------------------------------------------------------- /doc/stdlib/container/back.md: -------------------------------------------------------------------------------- 1 | # std::back 2 | TODO -------------------------------------------------------------------------------- /doc/stdlib/container/contains.md: -------------------------------------------------------------------------------- 1 | # std::contains 2 | 3 | ## std::contains(map, key) 4 | **Parameters:** 5 | * map: A Map 6 | 7 | **Return value:** 8 | Bool 9 | 10 | **Description:** 11 | Checks if a given _key_ is in the _map_ -------------------------------------------------------------------------------- /doc/stdlib/container/empty.md: -------------------------------------------------------------------------------- 1 | # std::empty 2 | TODO -------------------------------------------------------------------------------- /doc/stdlib/container/front.md: -------------------------------------------------------------------------------- 1 | # std::front 2 | TODO -------------------------------------------------------------------------------- /doc/stdlib/container/map.md: -------------------------------------------------------------------------------- 1 | # std::map 2 | 3 | ## std::map() 4 | 5 | **Return value:**: 6 | Reference to a new Map 7 | 8 | **Description:**: 9 | Creates a new and empty Map -------------------------------------------------------------------------------- /doc/stdlib/container/peek.md: -------------------------------------------------------------------------------- 1 | # std::peek 2 | 3 | ## std::peek(container) 4 | **Parameters:** 5 | * container: 6 | 1. Array 7 | 2. String 8 | 3. Stack 9 | 4. Queue 10 | 11 | **Return value:** 12 | Any value 13 | 14 | **Description:** 15 | Returns next value from a queue or stack without popping it. 16 | Returns last element of an array or string. -------------------------------------------------------------------------------- /doc/stdlib/container/pop.md: -------------------------------------------------------------------------------- 1 | # std::pop 2 | 3 | ## std::pop(container, elem) 4 | **Parameters:** 5 | 1. Array 6 | 3. Stack 7 | 4. Queue 8 | 9 | 10 | **Return value:** 11 | The popped value 12 | 13 | **Description:** 14 | Pops and returns value from a queue or stack. 15 | Removes and return last element of an array or string. -------------------------------------------------------------------------------- /doc/stdlib/container/push.md: -------------------------------------------------------------------------------- 1 | # std::push 2 | 3 | ## std::push(container, elem) 4 | **Parameters:**: 5 | * container: 6 | 1. Array 7 | 2. Queue 8 | 3. Stack 9 | * elem: A value to push 10 | 11 | **Return value:** 12 | null 13 | 14 | **Description:** 15 | 1. Pushes value to the end of the Array. 16 | 2. Pushed value to the end of the Queue. 17 | 3. Pushes value onto Stack. -------------------------------------------------------------------------------- /doc/stdlib/container/queue.md: -------------------------------------------------------------------------------- 1 | # std::queue 2 | 3 | ## std::queue() const 4 | 5 | **Return value:**: 6 | Reference to a new queue 7 | 8 | **Description:**: 9 | Creates a new and empty queue 10 | 11 | --- 12 | 13 | ## std::queue(first, other...) 14 | **Return value:** 15 | Reference to a new queue 16 | 17 | **Description:** 18 | Creates a new queue containing the specified elements (first and other) -------------------------------------------------------------------------------- /doc/stdlib/container/size.md: -------------------------------------------------------------------------------- 1 | # std::size 2 | ## std::size(container) 3 | **Parameters:** 4 | - container: 5 | 1. Array 6 | 2. Tuple 7 | 3. String 8 | 4. Queue 9 | 5. Stack 10 | 6. Map 11 | 6. Iterator 12 | 13 | **Return value:** 14 | int 15 | 16 | **Description:** 17 | Returns the number of elements in the container. -------------------------------------------------------------------------------- /doc/stdlib/container/stack.md: -------------------------------------------------------------------------------- 1 | # std::stack 2 | 3 | ## std::stack() const 4 | 5 | **Return value:** 6 | Reference to a new stack 7 | 8 | **Description:** 9 | Creates a new and empty stack 10 | 11 | --- 12 | 13 | ## std::stack(first, other...) 14 | 15 | **Return value:** 16 | Reference to a new stack 17 | 18 | **Description:** 19 | Creates a new stack containing the specified elements (first and other) -------------------------------------------------------------------------------- /doc/stdlib/functional/arity.md: -------------------------------------------------------------------------------- 1 | # std::arity 2 | 3 | ## std::arity(fx) 4 | **Parameters:** 5 | * fx : A function pointer 6 | 7 | **Return value:** 8 | int 9 | 10 | **Description:** 11 | The arity functions returns the number parameters which the function pointer requires. Variadic parameters are ignored. -------------------------------------------------------------------------------- /doc/stdlib/functional/chain.md: -------------------------------------------------------------------------------- 1 | # std::chain 2 | 3 | ## std::chain(fx1, fx2) 4 | **Parameters:** 5 | * fx1: A function pointer with 1 parameter 6 | * fx2: A function pointer with 1 parameter 7 | 8 | **Return value:** 9 | A function pointer. 10 | 11 | **Description:** 12 | The function chains two functions and returns a callable object. If the returned object is called fx1 is evaluated first and it's return value is fed into fx2. The return value of fx2 is returned. -------------------------------------------------------------------------------- /doc/stdlib/functional/external.md: -------------------------------------------------------------------------------- 1 | # std::external 2 | 3 | ## std::external(id) 4 | TODO -------------------------------------------------------------------------------- /doc/stdlib/functional/invoke.md: -------------------------------------------------------------------------------- 1 | # std::invoke 2 | 3 | ## std::invoke(fx, params) 4 | **Parameters:** 5 | * fx: A callable type 6 | * param: An array of parameters 7 | 8 | **Return value:** 9 | any 10 | 11 | **Description:** 12 | Takes a callable function pointer and an array of parameters. 13 | "std::invoke" calls the function and forwards the return value of the call. 14 | -------------------------------------------------------------------------------- /doc/stdlib/functional/is_variadic.md: -------------------------------------------------------------------------------- 1 | # std::is_variadic 2 | 3 | ## std::is_variadic(fx) 4 | **Parameters:** 5 | * fx: A function pointer 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Returns weather fx is a variadic function pointer. -------------------------------------------------------------------------------- /doc/stdlib/io/is_eof.md: -------------------------------------------------------------------------------- 1 | # std::is_eof 2 | 3 | ## std::is_eof(stream) 4 | **Parameters:** 5 | * stream: stream to check 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Returns true if stream has no characters left to read. -------------------------------------------------------------------------------- /doc/stdlib/io/istream/cin.md: -------------------------------------------------------------------------------- 1 | # std::cin 2 | 3 | ## std::cin() 4 | **Return value:** 5 | IStream 6 | 7 | **Description:** 8 | Creates an input stream connected to stdin -------------------------------------------------------------------------------- /doc/stdlib/io/istream/fin.md: -------------------------------------------------------------------------------- 1 | # std::fin 2 | 3 | ## std::fin(path) 4 | **Parameters:** 5 | path: Path to file as a string 6 | 7 | **Return value:** 8 | IStream 9 | 10 | **Description:** 11 | Creates a filestream to the specified path -------------------------------------------------------------------------------- /doc/stdlib/io/istream/strin.md: -------------------------------------------------------------------------------- 1 | # std::strin 2 | 3 | ## std::strin(str) 4 | **Parameters:** 5 | str: String to initialize string stream 6 | 7 | **Return value:** 8 | IStream 9 | 10 | **Description:** 11 | Creates a new input stringstream -------------------------------------------------------------------------------- /doc/stdlib/io/ostream/cout.md: -------------------------------------------------------------------------------- 1 | # std::cout 2 | 3 | ## std::cout() 4 | **Parameters:** 5 | 6 | **Return value:** 7 | OStream 8 | 9 | **Description:** 10 | Creates an output stream connected to stdout -------------------------------------------------------------------------------- /doc/stdlib/io/ostream/strout.md: -------------------------------------------------------------------------------- 1 | # std::strout 2 | 3 | ## std::strout() 4 | **Parameters:** 5 | 6 | **Return value:** 7 | OStream 8 | 9 | **Description:** 10 | Creates an output string stream -------------------------------------------------------------------------------- /doc/stdlib/io/print.md: -------------------------------------------------------------------------------- 1 | # std::print 2 | 3 | ## std::print(stream, value) 4 | **Parameters:** 5 | * stream: stream to print to 6 | * value: value to be printed 7 | 8 | **Return value:** 9 | null 10 | 11 | **Description:** 12 | Formats and prints value to stream 13 | 14 | --- 15 | 16 | ## std::print(value) 17 | **Parameters:** 18 | * value: value to be printed 19 | 20 | **Return value:** 21 | null 22 | 23 | **Description:** 24 | Formats and print value to stdout 25 | 26 | -------------------------------------------------------------------------------- /doc/stdlib/io/println.md: -------------------------------------------------------------------------------- 1 | # std::println 2 | 3 | ## std::println(stream, value) 4 | **Parameters:** 5 | * stream: stream to print to 6 | * value: value to be printed 7 | 8 | **Return value:** 9 | null 10 | 11 | **Description:** 12 | Formats and prints value to stream and adds newline ("\n") a the end 13 | 14 | --- 15 | 16 | ## std::println(value) 17 | **Parameters:** 18 | * value: value to be printed 19 | 20 | **Return value:** 21 | null 22 | 23 | **Description:** 24 | Formats and prints value to stdout and adds newline ("\n") a the end -------------------------------------------------------------------------------- /doc/stdlib/io/read_all.md: -------------------------------------------------------------------------------- 1 | # std::read_all 2 | 3 | ## std::read_all(stream) 4 | **Parameters:** 5 | * stream: an input stream 6 | 7 | **Return value:** 8 | string 9 | 10 | **Description:** 11 | Returns the entire stream buffer as a string -------------------------------------------------------------------------------- /doc/stdlib/io/read_int.md: -------------------------------------------------------------------------------- 1 | # std::read_int 2 | 3 | ## std::read_int() 4 | **Parameters:** 5 | 6 | **Return value:** 7 | optional<Int> 8 | 9 | **Description:** 10 | Reads an int from stdin. 11 | Null is returned if an error occurs or the stream reaches EOF. 12 | 13 | --- 14 | 15 | ## std::read_int(stream) 16 | **Parameters:** 17 | - stream: an input stream 18 | 19 | **Return value:** 20 | optional<Int> 21 | 22 | **Description:** 23 | Reads a Int from stream. 24 | Null is returned if an error occurs or the stream reaches EOF. -------------------------------------------------------------------------------- /doc/stdlib/io/readln.md: -------------------------------------------------------------------------------- 1 | # std::readln 2 | 3 | ## std::readln() 4 | **Parameters:** 5 | 6 | **Return value:** 7 | String 8 | 9 | **Description:** 10 | Reads a single line from stdin. 11 | 12 | --- 13 | 14 | ## std::readln(stream) 15 | **Parameters:** 16 | * stream: an input stream 17 | 18 | **Return value:** 19 | String 20 | 21 | **Description:** 22 | Reads a single line from stream. -------------------------------------------------------------------------------- /doc/stdlib/iter/get.md: -------------------------------------------------------------------------------- 1 | # std::iter::get 2 | 3 | ## std::iter::get(iterator) 4 | **Parameters:** 5 | - iterator: any iterator 6 | 7 | **Return value:** 8 | any 9 | 10 | **Description:** 11 | Returns the current value. 12 | Returns an iterator_stop value if the iterator reached the end. -------------------------------------------------------------------------------- /doc/stdlib/iter/is_stop.md: -------------------------------------------------------------------------------- 1 | # std::iter::is_stop 2 | 3 | ## std::iter::is_stop(value) const 4 | **Parameters:** 5 | - value: any value 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Returns wether value is of type iterator_stop. -------------------------------------------------------------------------------- /doc/stdlib/iter/move.md: -------------------------------------------------------------------------------- 1 | # std::iter::move 2 | 3 | ## std::iter::move(iterator, steps) 4 | **Parameters:** 5 | - iterator: any iterator 6 | 7 | **Return value:** 8 | any 9 | 10 | **Description:** 11 | Moves the iterator 3 steps. Negative steps are interpreted as backward movement. -------------------------------------------------------------------------------- /doc/stdlib/iter/next.md: -------------------------------------------------------------------------------- 1 | # std::iter::next 2 | 3 | ## std::iter::next(iterator) 4 | **Parameters:** 5 | - iterator: any iterator 6 | 7 | **Return value:** 8 | any 9 | 10 | **Description:** 11 | Advances the iterator and returns the current value. 12 | Returns an iterator_stop value if the iterator reached the end. -------------------------------------------------------------------------------- /doc/stdlib/iter/reversed.md: -------------------------------------------------------------------------------- 1 | # std::iter::reversed 2 | 3 | ## std::iter::reversed(iter) const 4 | **Parameters:** 5 | - iter: iterable object 6 | 7 | **Return value:** 8 | iterator 9 | 10 | **Description:** 11 | Creates a reversed iterator which traverses the underlying iterator from back to front. -------------------------------------------------------------------------------- /doc/stdlib/iter/zipped.md: -------------------------------------------------------------------------------- 1 | # std::iter::zipped 2 | 3 | ## std::iter::zipped(ranges) const 4 | **Parameters:** 5 | - iters: tuple of iterable values 6 | 7 | **Return value:** 8 | iterator 9 | 10 | **Description:** 11 | Creates a zipped iterator. -------------------------------------------------------------------------------- /doc/stdlib/math/abs.md: -------------------------------------------------------------------------------- 1 | # std::abs 2 | 3 | ## std::abs(x) const 4 | **Parameter:** 5 | - x: Numeric value 6 | 7 | **Return value:** 8 | Numeric value 9 | 10 | **Descriptions:** 11 | Returns the absolute value -------------------------------------------------------------------------------- /doc/stdlib/math/cbrt.md: -------------------------------------------------------------------------------- 1 | # std::cbrt 2 | 3 | ### std::cbrt(x) const 4 | 5 | **Descriptions:** 6 | Calculates the cubic-root of a numeric value as float. -------------------------------------------------------------------------------- /doc/stdlib/math/ceil.md: -------------------------------------------------------------------------------- 1 | # std::ceil 2 | 3 | ## std::ceil(x) const 4 | 5 | **Descriptions:** 6 | Rounds numeric value to closest greater integer. -------------------------------------------------------------------------------- /doc/stdlib/math/clamp.md: -------------------------------------------------------------------------------- 1 | # std::clamp 2 | 3 | ## std::clamp(value, min, max) 4 | **Parameters:** 5 | - value: any value 6 | - min: any value 7 | - max: any value 8 | 9 | **Return value:** 10 | any value 11 | 12 | **Descriptions:** 13 | Returns min if value < min and max if value > max. Otherwise value is returned. -------------------------------------------------------------------------------- /doc/stdlib/math/cos.md: -------------------------------------------------------------------------------- 1 | # std::cos 2 | 3 | ### std::cos(x) const 4 | **Parameters:** 5 | - a: Numeric value 6 | 7 | **Return value:** 8 | Float 9 | 10 | **Descriptions:** 11 | Calculates the cosine of x. -------------------------------------------------------------------------------- /doc/stdlib/math/e.md: -------------------------------------------------------------------------------- 1 | # std::e 2 | Global defintion of e / Euler's number 3 | 4 | ## Examples 5 | ### 1) 6 | ```js 7 | function main() { 8 | std::println(std::e); 9 | } 10 | ``` 11 | Possible output: 12 | ``` 13 | 2.71828 14 | ``` 15 | -------------------------------------------------------------------------------- /doc/stdlib/math/floor.md: -------------------------------------------------------------------------------- 1 | # std::floor 2 | 3 | ## std::floor(x) const 4 | 5 | **Descriptions:** 6 | Rounds numeric value to closest lesser integer. 7 | -------------------------------------------------------------------------------- /doc/stdlib/math/hypot.md: -------------------------------------------------------------------------------- 1 | # std::hypot 2 | 3 | ## std::hypot(a, b) const 4 | 5 | **Descriptions:** 6 | Solves the Pythagorean Theorem (a^2 + b^2 = c^2) for c. -------------------------------------------------------------------------------- /doc/stdlib/math/is_between.md: -------------------------------------------------------------------------------- 1 | # std::is_between 2 | 3 | ## std::is_between(value, min, max) const 4 | 5 | **Parameters:** 6 | - value: value to check 7 | - min: minimum value 8 | - max: maximum value 9 | 10 | **Return value:** 11 | bool 12 | 13 | **Description:** 14 | Checks whether value lies between min and max. -------------------------------------------------------------------------------- /doc/stdlib/math/ld.md: -------------------------------------------------------------------------------- 1 | # std::ld 2 | 3 | ## std::ld(x) const 4 | 5 | **Parameters:** 6 | - x: Numeric value 7 | 8 | **Return value:** 9 | Numeric value 10 | 11 | **Descriptions:** 12 | Returns the binary logarithm for x -------------------------------------------------------------------------------- /doc/stdlib/math/lerp.md: -------------------------------------------------------------------------------- 1 | # std::lerp 2 | 3 | ## std::lerp(a, b, t) 4 | **Parameters:** 5 | - a: minimum value 6 | - b: maximum value 7 | - t: sample point between 0 and 1 8 | 9 | **Return value:** 10 | float 11 | 12 | **Description:** 13 | Calculates a+t*(b-a). 14 | When t is 0 the the return value is a. 15 | When t is 1 the the return value is b. -------------------------------------------------------------------------------- /doc/stdlib/math/lg.md: -------------------------------------------------------------------------------- 1 | # std::lg 2 | 3 | ## std::lg(x, b) 4 | 5 | **Parameters:** 6 | - x: Numeric value 7 | - b: Base 8 | 9 | **Descriptions:** 10 | Returns the decimal logarithm for x -------------------------------------------------------------------------------- /doc/stdlib/math/ln.md: -------------------------------------------------------------------------------- 1 | # std::ln 2 | 3 | ## std::ld(x) const 4 | 5 | **Descriptions:** 6 | Returns the natural logrithm of x -------------------------------------------------------------------------------- /doc/stdlib/math/log.md: -------------------------------------------------------------------------------- 1 | # std::log 2 | 3 | ## std::log(x, b) const 4 | 5 | **Parameters:** 6 | - x: Numeric value 7 | - b: Base 8 | 9 | **Return value:** 10 | Numeric value 11 | 12 | **Descriptions:** 13 | Returns the logrithm to the base b of x. -------------------------------------------------------------------------------- /doc/stdlib/math/max.md: -------------------------------------------------------------------------------- 1 | # std::max 2 | 3 | ## std::max(a, b) 4 | 5 | **Parameters:** 6 | - a: Any value 7 | - b: Any value 8 | 9 | **Returns value:** 10 | Returns the greater of two values. 11 | Favors "b" in case of a tie. -------------------------------------------------------------------------------- /doc/stdlib/math/min.md: -------------------------------------------------------------------------------- 1 | # std::min 2 | 3 | ## std::min(a, b) 4 | 5 | **Parameters:** 6 | - a: Any value 7 | - b: Any value 8 | 9 | **Returns value:** 10 | Returns the lesser of two values. 11 | Favors "a" in case of a tie. 12 | 13 | -------------------------------------------------------------------------------- /doc/stdlib/math/pi.md: -------------------------------------------------------------------------------- 1 | # std::pi 2 | 3 | Global definition which defines pi to least 5 decimals places 4 | 5 | ## Possible implementation 6 | define pi = 3.14159265359; 7 | 8 | ## Examples 9 | ### 1) 10 | ```js 11 | function main() { 12 | std::println(std::pi); 13 | } 14 | ``` 15 | Possible output: 16 | ``` 17 | 3.14159 18 | ``` 19 | -------------------------------------------------------------------------------- /doc/stdlib/math/pow.md: -------------------------------------------------------------------------------- 1 | # std::pow 2 | 3 | ## std::pow(b, x) const 4 | 5 | **Parameters:** 6 | - b: Base 7 | - x: Exponent 8 | 9 | **Descriptions:** 10 | Returns `a` to the power of `x`. -------------------------------------------------------------------------------- /doc/stdlib/math/round.md: -------------------------------------------------------------------------------- 1 | # std::round 2 | 3 | ## std::round(a:oat) const 4 | **Parameter:** 5 | - a: Numeric value 6 | 7 | **Return value:** 8 | Integral value 9 | 10 | **Descriptions:** 11 | Rounds numeric value to closest integer. 12 | -------------------------------------------------------------------------------- /doc/stdlib/math/sin.md: -------------------------------------------------------------------------------- 1 | # std::sin 2 | 3 | ### std::sin(x) const 4 | 5 | **Descriptions:** 6 | Calculates the sine of x. -------------------------------------------------------------------------------- /doc/stdlib/math/sqrt.md: -------------------------------------------------------------------------------- 1 | # std::sqrt 2 | 3 | ### std::sqrt(a) const 4 | 5 | **Descriptions:** 6 | Returns square-root of numeric value as float. -------------------------------------------------------------------------------- /doc/stdlib/math/tan.md: -------------------------------------------------------------------------------- 1 | # std::tan 2 | 3 | ### std::tan(x) const 4 | 5 | **Descriptions:** 6 | Calculates the tagent of x. -------------------------------------------------------------------------------- /doc/stdlib/math/tau.md: -------------------------------------------------------------------------------- 1 | # std::tau 2 | Global definition of the constant tau = 2 * pi 3 | 4 | ## Examples 5 | ### 1) 6 | ```js 7 | function main() { 8 | std::println(std::tau); 9 | } 10 | ``` 11 | Possible output: 12 | ``` 13 | 6.28318 14 | ``` 15 | -------------------------------------------------------------------------------- /doc/stdlib/random/decision.md: -------------------------------------------------------------------------------- 1 | # std::random::decision 2 | 3 | ## std::random::decision(rng, min, max) 4 | since 1.3 5 | **Parameters:** 6 | * rng: RandomEngine 7 | * p: propability 8 | 9 | **Return value:** 10 | Bool 11 | 12 | **Description:** 13 | Generates a random Bool. "p" is the proabilty of the return value being true. -------------------------------------------------------------------------------- /doc/stdlib/random/rand.md: -------------------------------------------------------------------------------- 1 | # std::randome::rand 2 | 3 | ## std::random::rand(rng) 4 | since 1.3 5 | **Parameters:** 6 | * rng: RandomEngine 7 | 8 | **Return value:** 9 | Int 10 | 11 | **Description:** 12 | Generates a random 64-Bit integer -------------------------------------------------------------------------------- /doc/stdlib/random/rand_element.md: -------------------------------------------------------------------------------- 1 | # std::random::rand_element 2 | 3 | ## std::rand_element(rng, range) 4 | since 1.3 5 | **Parameters:** 6 | * rng: RandomEngine 7 | * range: Indexable and sized object 8 | 9 | **Return value:** 10 | any 11 | 12 | **Description:** 13 | Chooses random element from range. 14 | Throws id range is empty -------------------------------------------------------------------------------- /doc/stdlib/random/rand_float.md: -------------------------------------------------------------------------------- 1 | # std::random::rand_float 2 | 3 | ## std::random::rand_float(rng, min, max) 4 | since 1.3 5 | **Parameters:** 6 | * rng: RandomEngine 7 | * min: Float 8 | * max: Float 9 | 10 | **Return value:** 11 | Float 12 | 13 | **Description:** 14 | Generates a random float between min and max -------------------------------------------------------------------------------- /doc/stdlib/random/rand_int.md: -------------------------------------------------------------------------------- 1 | # std::random::rand_int 2 | 3 | ## std::random::rand_int(rng, min, max) 4 | since 1.3 5 | **Parameters:** 6 | * rng: RandomEngine 7 | * min: Int 8 | * max: Int 9 | 10 | **Return value:** 11 | Int 12 | 13 | **Description:** 14 | Generates a random integer between min and max -------------------------------------------------------------------------------- /doc/stdlib/random/split.md: -------------------------------------------------------------------------------- 1 | # std::random::split 2 | 3 | ## std::random::split(rng) 4 | since 1.3 5 | **Parameters:** 6 | * rng: RandomEngine 7 | 8 | **Return value:** 9 | RandomEngine 10 | 11 | **Description:** 12 | Creates a new RandomEngine of the same type as "rng" and uses "rng" to seed the new engine. -------------------------------------------------------------------------------- /doc/stdlib/type/cast.md: -------------------------------------------------------------------------------- 1 | # std::cast 2 | 3 | ## std::cast(type, value) 4 | **Parameters:** 5 | * type: a type 6 | * value: any value 7 | 8 | **Return value:** 9 | A value of type or null 10 | 11 | **Description:** 12 | Returns the casted result if successful or returns null if the cast is invalid. -------------------------------------------------------------------------------- /doc/stdlib/type/clone.md: -------------------------------------------------------------------------------- 1 | # std::clone 2 | TODO -------------------------------------------------------------------------------- /doc/stdlib/type/has_special_add.md: -------------------------------------------------------------------------------- 1 | # std::has_special_add 2 | ## std::has_special_add(obj) const 3 | 4 | **Parameters:** 5 | * obj: a struct object 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Checks if object contains a valid `{add}` special member. -------------------------------------------------------------------------------- /doc/stdlib/type/has_special_cmp.md: -------------------------------------------------------------------------------- 1 | # std::has_special_cmp 2 | ## std::has_special_cmp(obj) const 3 | 4 | **Parameters:** 5 | * obj: a struct object 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Checks if object contains a valid `{cmp}` special member. -------------------------------------------------------------------------------- /doc/stdlib/type/has_special_div.md: -------------------------------------------------------------------------------- 1 | # std::has_special_div 2 | ## std::has_special_div(obj) const 3 | 4 | **Parameters:** 5 | * obj: a struct object 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Checks if object contains a valid `{div}` special member. -------------------------------------------------------------------------------- /doc/stdlib/type/has_special_mlt.md: -------------------------------------------------------------------------------- 1 | # std::has_special_mlt 2 | ## std::has_special_mlt(obj) const 3 | 4 | **Parameters:** 5 | * obj: a struct object 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Checks if object contains a valid `{mlt}` special member. -------------------------------------------------------------------------------- /doc/stdlib/type/has_special_mod.md: -------------------------------------------------------------------------------- 1 | # std::has_special_mod 2 | ## std::has_special_mod(obj) const 3 | 4 | **Parameters:** 5 | * obj: a struct object 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Checks if object contains a valid `{mod}` special member. -------------------------------------------------------------------------------- /doc/stdlib/type/has_special_pow.md: -------------------------------------------------------------------------------- 1 | # std::has_special_pow 2 | ## std::has_special_pow(obj) const 3 | 4 | **Parameters:** 5 | * obj: a struct object 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Checks if object contains a valid `{pow}` special member. -------------------------------------------------------------------------------- /doc/stdlib/type/has_special_str.md: -------------------------------------------------------------------------------- 1 | # std::has_special_str 2 | ## std::has_special_str(obj) const 3 | 4 | **Parameters:** 5 | * obj: a struct object 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Checks if object contains a valid `{str}` special member. -------------------------------------------------------------------------------- /doc/stdlib/type/has_special_sub.md: -------------------------------------------------------------------------------- 1 | # std::has_special_sub 2 | ## std::has_special_sub(obj) const 3 | 4 | **Parameters:** 5 | * obj: a struct object 6 | 7 | **Return value:** 8 | bool 9 | 10 | **Description:** 11 | Checks if object contains a valid `{sub}` special member. -------------------------------------------------------------------------------- /doc/stdlib/type/is.md: -------------------------------------------------------------------------------- 1 | # std::is 2 | 3 | ## std::is(type, value) 4 | **Parameters:** 5 | * type: a type 6 | * value: any value 7 | 8 | **Return value:** 9 | bool 10 | 11 | **Description:** 12 | Checks wether the value matches the type. -------------------------------------------------------------------------------- /doc/stdlib/type/mono.md: -------------------------------------------------------------------------------- 1 | # std::mono 2 | 3 | ## preset std::mono(value) 4 | **Parameters:** 5 | * value: a single value of any type 6 | 7 | **Return value:** 8 | Reference to a new Struct 9 | 10 | **Description:** 11 | Creates a new struct with a single member called value -------------------------------------------------------------------------------- /doc/stdlib/type/null_v.md: -------------------------------------------------------------------------------- 1 | # std::null_v 2 | 3 | ## std::null_v() 4 | **Parameters:** 5 | 6 | **Return value:** 7 | null 8 | 9 | **Description:** 10 | Returns null -------------------------------------------------------------------------------- /doc/stdlib/type/pair.md: -------------------------------------------------------------------------------- 1 | # std::pair 2 | 3 | ## preset std::pair(first, second) 4 | since 2.0 5 | **Parameters:** 6 | * first: a value of any type 7 | * second: a value of any type 8 | 9 | **Return value:** 10 | Reference to a new Struct 11 | 12 | **Description:** 13 | Creates a new Struct with two members called "first" and "second" -------------------------------------------------------------------------------- /doc/stdlib/type/struct.md: -------------------------------------------------------------------------------- 1 | # std::struct 2 | 3 | ## std::struct() 4 | **Return value:** 5 | Reference to a new Struct 6 | 7 | **Description:** 8 | Creates a new Struct without members -------------------------------------------------------------------------------- /doc/technical/intrinsics: -------------------------------------------------------------------------------- 1 | # Intrinsics 2 | 3 | ## __type 4 | 5 | Evaluates to null at compile-time but indicates an assignment of a type at load-time or run-time. 6 | This is used for indicating stdlib types. -------------------------------------------------------------------------------- /doc/types/coroutine.md: -------------------------------------------------------------------------------- 1 | # Coroutine / std::Coroutine 2 | 3 | ## Static Functions 4 | 5 | ### . is(value : Any) : Bool 6 | 7 | Checks whether value is a coroutine. 8 | 9 | ### . cast(value : Any) : Coroutine 10 | 11 | Returns value if value is a coroutine. Otherwise null is returned. -------------------------------------------------------------------------------- /doc/types/istream.md: -------------------------------------------------------------------------------- 1 | # Input Stream / std::IStream 2 | 3 | Istreams are used to read 8-Bit characters from a varity of sources e.g. stdin or files. 4 | 5 | ## Sources 6 | 7 | - Files: fin, fout 8 | - Stdin/Stdout: cin, cout 9 | - Stringbuffers: strin, strout 10 | 11 | 12 | ## Static Functions 13 | 14 | ### . is(value : Any) : Bool 15 | 16 | Checks whether value is an input stream. 17 | 18 | ### . cast(value : Any) : IStream 19 | 20 | Returns value if value is a input stream. Otherwise null is returned. -------------------------------------------------------------------------------- /doc/types/null.md: -------------------------------------------------------------------------------- 1 | # Null / std::Null 2 | 3 | The null type indicates a non-existing value. A value of type null can be created by the `null` keyword. 4 | 5 | **Example** 6 | ```js 7 | function main() { 8 | var a = null; 9 | } 10 | ``` 11 | 12 | ## Static Functions 13 | 14 | ### . new() : Null 15 | 16 | Returns `null`. 17 | 18 | ### . is(value : Any) : Bool 19 | 20 | Checks whether value is `null`. 21 | 22 | ### . cast(value : Any) : Bool 23 | 24 | Returns `null`. -------------------------------------------------------------------------------- /doc/types/ostream.md: -------------------------------------------------------------------------------- 1 | # Ouput Stream / std::OStream 2 | 3 | Ostreams are used to output 8-Bit characters to a varity of targets e.g. stdout or files. 4 | 5 | ## Static Functions 6 | 7 | ### . is(value : Any) : Bool 8 | 9 | Checks whether value is an output stream. 10 | 11 | ### . cast(value : Any) : OStream 12 | 13 | Returns value if value is a output stream. Otherwise null is returned. -------------------------------------------------------------------------------- /doc/types/rng.md: -------------------------------------------------------------------------------- 1 | # Randome Number Generator / std::Random 2 | 3 | 4 | ### . is(value : Any) : Bool 5 | 6 | Checks whether value is a random number generator. 7 | 8 | ### . cast(value : Any) : OStream 9 | 10 | Returns value if value is a random number generator. Otherwise null is returned. -------------------------------------------------------------------------------- /examples/newtons_method.sh: -------------------------------------------------------------------------------- 1 | echo "=== Newton's Method ===" 2 | ./bin/ltn examples/newtons_method.ltn 3 | echo 4 | -------------------------------------------------------------------------------- /examples/run_all.sh: -------------------------------------------------------------------------------- 1 | ./examples/skytale.sh 2 | ./examples/newtons_method.sh 3 | ./examples/unicode.sh -------------------------------------------------------------------------------- /examples/skytale.sh: -------------------------------------------------------------------------------- 1 | echo "=== Skytale ===" 2 | ./bin/ltn examples/skytale.ltn 3 | echo 4 | -------------------------------------------------------------------------------- /examples/unicode.ltn: -------------------------------------------------------------------------------- 1 | function main() { 2 | std::println("Umlaute: äüöÄÜÖ"); 3 | std::println("Україна"); 4 | std::println("日本"); 5 | std::println("La République Française"); 6 | } -------------------------------------------------------------------------------- /examples/unicode.sh: -------------------------------------------------------------------------------- 1 | echo "=== Unicode ===" 2 | ./bin/ltn examples/unicode.ltn 3 | echo 4 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | sudo cp bin/litan /usr/local/bin/litan 2 | -------------------------------------------------------------------------------- /litan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | project(Litan) 4 | set(CMAKE_CXX_STANDARD 20) 5 | 6 | add_executable(litan 7 | "litan.cxx" 8 | "shared/file.cxx" 9 | "shared/help.cxx" 10 | "shared/options.cxx" 11 | "commands/build.cxx" 12 | "commands/exec.cxx" 13 | "commands/dump.cxx" 14 | "commands/run.cxx" 15 | ) 16 | 17 | target_link_libraries(litan PRIVATE 18 | litan_compiler 19 | litan_vm 20 | ) 21 | -------------------------------------------------------------------------------- /litan/commands/build.hxx: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | int build(std::span args); 6 | -------------------------------------------------------------------------------- /litan/commands/dump.hxx: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | int dump(std::span args); -------------------------------------------------------------------------------- /litan/commands/exec.hxx: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | int exec(std::span args); -------------------------------------------------------------------------------- /litan/commands/run.hxx: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | int run(std::span args); -------------------------------------------------------------------------------- /litan/shared/file.hxx: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | std::ofstream open_file(const std::filesystem::path & path, std::ios::openmode openmode); 6 | -------------------------------------------------------------------------------- /litan/shared/help.cxx: -------------------------------------------------------------------------------- 1 | #include "help.hxx" 2 | #include 3 | 4 | void print_usage_hint() { 5 | std::cout << "Usage:\n"; 6 | std::cout << " run [options...]