├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ ├── feature_request.yml │ └── question.yml └── workflows │ ├── ci_cd.yml │ └── docs.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── cli ├── main.aspl └── utils │ ├── full_template.aspl │ ├── update.aspl │ └── version.aspl ├── examples ├── consonants_and_vowels │ └── main.aspl ├── double_pendulum │ ├── Pendulum.aspl │ └── main.aspl ├── fahrenheit_to_celsius │ └── main.aspl ├── fibonacci_numbers │ └── main.aspl ├── hello_world │ └── main.aspl ├── json_basics │ └── main.aspl ├── julia_set │ └── main.aspl ├── quicksort │ └── main.aspl ├── sqlite_basics │ └── main.aspl └── usd_to_euro │ └── main.aspl ├── install.bat ├── install.md ├── install.sh ├── introduction.md ├── runtime └── ailinterpreter │ ├── README.md │ ├── builtins.c │ ├── byte_list.c │ ├── byte_list.h │ ├── implementations.c │ ├── instructions.h │ ├── interpreter.c │ ├── interpreter.h │ └── main.c ├── stdlib ├── appbundle │ ├── Workaround.aspl │ └── generator │ │ └── Bundle.aspl ├── aspl │ ├── README.md │ ├── compiler │ │ ├── CompilationResult.aspl │ │ ├── backend │ │ │ ├── Backend.aspl │ │ │ ├── bytecode │ │ │ │ ├── ByteList.aspl │ │ │ │ ├── BytecodeBackend.aspl │ │ │ │ ├── IntType.aspl │ │ │ │ ├── ail │ │ │ │ │ ├── AILBytecodeBackend.aspl │ │ │ │ │ ├── Instruction.aspl │ │ │ │ │ └── TypeUtils.aspl │ │ │ │ └── twail │ │ │ │ │ ├── Instruction.aspl │ │ │ │ │ ├── TreeWalkingAILBytecodeBackend.aspl │ │ │ │ │ └── TypeUtils.aspl │ │ │ └── stringcode │ │ │ │ ├── StringcodeBackend.aspl │ │ │ │ └── c │ │ │ │ ├── .gitignore │ │ │ │ ├── CBackend.aspl │ │ │ │ ├── CallbackDeclaration.aspl │ │ │ │ ├── CatchBlockDeclaration.aspl │ │ │ │ ├── IdentifierEscapeUtils.aspl │ │ │ │ ├── TypeUtils.aspl │ │ │ │ └── template.c │ │ ├── main.aspl │ │ └── utils │ │ │ ├── IncludeUtils.aspl │ │ │ ├── LinkUtils.aspl │ │ │ ├── filenames.aspl │ │ │ └── templates.aspl │ └── parser │ │ ├── Module.aspl │ │ ├── Options.aspl │ │ ├── ParseFileResult.aspl │ │ ├── Parser.aspl │ │ ├── ParserResult.aspl │ │ ├── Timings.aspl │ │ ├── ast │ │ ├── Node.aspl │ │ ├── expressions │ │ │ ├── AndExpression.aspl │ │ │ ├── BinaryOperator.aspl │ │ │ ├── CastExpression.aspl │ │ │ ├── CatchExpression.aspl │ │ │ ├── CheckEqualsExpression.aspl │ │ │ ├── ClassInstantiateExpression.aspl │ │ │ ├── DereferenceExpression.aspl │ │ │ ├── DivideExpression.aspl │ │ │ ├── EmbedFileExpression.aspl │ │ │ ├── EnumFieldAccessExpression.aspl │ │ │ ├── Expression.aspl │ │ │ ├── FunctionCallExpression.aspl │ │ │ ├── GreaterThanExpression.aspl │ │ │ ├── GreaterThanOrEqualExpression.aspl │ │ │ ├── ImplementationCallExpression.aspl │ │ │ ├── LessThanExpression.aspl │ │ │ ├── LessThanOrEqualExpression.aspl │ │ │ ├── ListAssignExpression.aspl │ │ │ ├── ListIndexExpression.aspl │ │ │ ├── MapAccessExpression.aspl │ │ │ ├── MapAssignExpression.aspl │ │ │ ├── MinusExpression.aspl │ │ │ ├── ModuloExpression.aspl │ │ │ ├── MultiplyExpression.aspl │ │ │ ├── NegateExpression.aspl │ │ │ ├── NonStaticMethodCallExpression.aspl │ │ │ ├── NonStaticPropertyAccessExpression.aspl │ │ │ ├── NonStaticPropertyAssignExpression.aspl │ │ │ ├── OfTypeExpression.aspl │ │ │ ├── OrExpression.aspl │ │ │ ├── ParentExpression.aspl │ │ │ ├── PlusExpression.aspl │ │ │ ├── PropagateErrorExpression.aspl │ │ │ ├── ReferenceExpression.aspl │ │ │ ├── StaticMethodCallExpression.aspl │ │ │ ├── StaticPropertyAccessExpression.aspl │ │ │ ├── StaticPropertyAssignExpression.aspl │ │ │ ├── StringIndexExpression.aspl │ │ │ ├── ThisExpression.aspl │ │ │ ├── UnaryOperator.aspl │ │ │ ├── VariableAccessExpression.aspl │ │ │ ├── VariableAssignExpression.aspl │ │ │ ├── VariableDeclareExpression.aspl │ │ │ └── XorExpression.aspl │ │ ├── literals │ │ │ ├── BooleanLiteral.aspl │ │ │ ├── ByteLiteral.aspl │ │ │ ├── CallbackLiteral.aspl │ │ │ ├── DoubleLiteral.aspl │ │ │ ├── FloatLiteral.aspl │ │ │ ├── IntegerLiteral.aspl │ │ │ ├── ListLiteral.aspl │ │ │ ├── Literal.aspl │ │ │ ├── LongLiteral.aspl │ │ │ ├── MapLiteral.aspl │ │ │ ├── NullLiteral.aspl │ │ │ └── StringLiteral.aspl │ │ └── statements │ │ │ ├── AssertStatement.aspl │ │ │ ├── BlockStatement.aspl │ │ │ ├── BreakStatement.aspl │ │ │ ├── ClassDeclareStatement.aspl │ │ │ ├── ContinueStatement.aspl │ │ │ ├── EnumDeclareStatement.aspl │ │ │ ├── EscapeStatement.aspl │ │ │ ├── FallbackStatement.aspl │ │ │ ├── ForeachStatement.aspl │ │ │ ├── FunctionDeclareStatement.aspl │ │ │ ├── IfElseIfStatement.aspl │ │ │ ├── IfElseStatement.aspl │ │ │ ├── IfStatement.aspl │ │ │ ├── IncludeFileStatement.aspl │ │ │ ├── LinkLibraryStatement.aspl │ │ │ ├── MethodDeclareStatement.aspl │ │ │ ├── NopStatement.aspl │ │ │ ├── PropertyDeclareStatement.aspl │ │ │ ├── RepeatStatement.aspl │ │ │ ├── ReturnStatement.aspl │ │ │ ├── Statement.aspl │ │ │ ├── ThrowStatement.aspl │ │ │ └── WhileStatement.aspl │ │ ├── attributes │ │ ├── Attribute.aspl │ │ ├── AttributeInstance.aspl │ │ └── AttributeUsage.aspl │ │ ├── callbacks │ │ └── Callback.aspl │ │ ├── classes │ │ └── Class.aspl │ │ ├── enums │ │ ├── Enum.aspl │ │ └── EnumField.aspl │ │ ├── functions │ │ ├── CustomFunction.aspl │ │ ├── Function.aspl │ │ └── InternalFunction.aspl │ │ ├── lexer │ │ ├── Lexer.aspl │ │ ├── RegexTokenPattern.aspl │ │ ├── RegularTokenPattern.aspl │ │ ├── StringToken.aspl │ │ ├── Token.aspl │ │ ├── TokenPattern.aspl │ │ └── TokenType.aspl │ │ ├── main.aspl │ │ ├── methods │ │ ├── CustomMethod.aspl │ │ ├── InternalMethod.aspl │ │ └── Method.aspl │ │ ├── precedence │ │ ├── PrecedenceLevel.aspl │ │ └── PrecedenceUtils.aspl │ │ ├── properties │ │ ├── CustomNormalProperty.aspl │ │ ├── CustomReactiveProperty.aspl │ │ ├── InternalProperty.aspl │ │ ├── Property.aspl │ │ └── ReactivePropertyCallback.aspl │ │ ├── utils │ │ ├── AttributeUtils.aspl │ │ ├── ClassUtils.aspl │ │ ├── DirectoryUtils.aspl │ │ ├── ErrorUtils.aspl │ │ ├── GenericsUtils.aspl │ │ ├── IdentifierResult.aspl │ │ ├── IdentifierUtils.aspl │ │ ├── ImplementationCallUtils.aspl │ │ ├── ImportTable.aspl │ │ ├── Location.aspl │ │ ├── ModuleUtils.aspl │ │ ├── Pair.aspl │ │ ├── Parameter.aspl │ │ ├── ParseMode.aspl │ │ ├── ReturnTypeUtils.aspl │ │ ├── TokenList.aspl │ │ ├── TokenUtils.aspl │ │ ├── Type.aspl │ │ ├── Types.aspl │ │ ├── errors.aspl │ │ └── expressions.aspl │ │ └── variables │ │ ├── Scope.aspl │ │ ├── ScopeBundle.aspl │ │ └── Variable.aspl ├── bitconverter │ ├── converter.aspl │ └── implementations │ │ ├── implementations.aspl │ │ └── implementations.c ├── breakpoints │ ├── breakpoints.aspl │ └── implementations │ │ ├── implementations.aspl │ │ └── implementations.c ├── chars │ ├── chars.aspl │ └── implementations │ │ ├── implementations.aspl │ │ └── implementations.c ├── console │ └── colors.aspl ├── encoding │ ├── ascii │ │ ├── LegacyASCIITable.aspl │ │ ├── decoder.aspl │ │ └── encoder.aspl │ ├── base64 │ │ ├── base64.aspl │ │ └── implementations │ │ │ ├── implementations.aspl │ │ │ └── implementations.c │ ├── hex │ │ └── hex.aspl │ └── utf8 │ │ ├── implementations │ │ ├── implementations.aspl │ │ └── implementations.c │ │ └── utf8.aspl ├── graphics │ ├── Canvas.aspl │ ├── Color.aspl │ ├── Font.aspl │ ├── HorizontalAlignment.aspl │ ├── ICanvas.aspl │ ├── KeyCode.aspl │ ├── LazyChunkedCanvas.aspl │ ├── MouseButton.aspl │ ├── PrimitiveChunkedCanvas.aspl │ ├── TouchPoint.aspl │ ├── TouchToolType.aspl │ ├── VerticalAlignment.aspl │ ├── Window.aspl │ ├── implementations │ │ ├── implementations.aspl │ │ └── implementations.c │ └── text.aspl ├── gui │ ├── Control.aspl │ ├── README.md │ ├── SingleLineTextBox.aspl │ └── VirtualKeyboard.aspl ├── internet │ ├── AddressFamily.aspl │ ├── HttpResponse.aspl │ ├── TcpSocketClient.aspl │ ├── WebSocketClient.aspl │ ├── WebSocketServer.aspl │ ├── WebSocketServerClient.aspl │ ├── http.aspl │ └── implementations │ │ ├── implementations.aspl │ │ └── implementations.c ├── io │ ├── BinaryStream.aspl │ ├── Stream.aspl │ ├── directories.aspl │ ├── files.aspl │ ├── glob.aspl │ ├── implementations │ │ ├── implementations.aspl │ │ └── implementations.c │ ├── path.aspl │ └── symlink.aspl ├── json │ ├── Token.aspl │ ├── TokenList.aspl │ ├── TokenType.aspl │ ├── decoder.aspl │ ├── encoder.aspl │ └── main.aspl ├── math │ ├── abs.aspl │ ├── angular_units.aspl │ ├── comparison.aspl │ ├── constants.aspl │ ├── geometry │ │ ├── Ellipse.aspl │ │ ├── Point.aspl │ │ ├── Rectangle.aspl │ │ └── Size.aspl │ ├── implementations │ │ ├── implementations.aspl │ │ └── implementations.c │ ├── pow.aspl │ ├── round.aspl │ └── trigonometry.aspl ├── os │ ├── Architecture.aspl │ ├── CommandResult.aspl │ ├── args.aspl │ ├── commands.aspl │ ├── fs.aspl │ ├── implementations │ │ ├── implementations.aspl │ │ └── implementations.c │ └── os.aspl ├── rand │ ├── implementations │ │ ├── implementations.aspl │ │ └── implementations.c │ └── main.aspl ├── regex │ ├── Match.aspl │ ├── implementations │ │ ├── implementations.aspl │ │ └── implementations.c │ └── regex.aspl ├── sqlite │ ├── Database.aspl │ ├── Response.aspl │ ├── Statement.aspl │ └── implementations │ │ ├── implementations.aspl │ │ └── implementations.c ├── strings │ ├── StringBuilder.aspl │ └── implementations │ │ ├── implementations.aspl │ │ └── implementations.c ├── time │ ├── Timestamp.aspl │ ├── implementations │ │ ├── implementations.aspl │ │ └── implementations.c │ ├── sleep.aspl │ └── time.aspl └── zip │ ├── implementations │ ├── implementations.aspl │ └── implementations.c │ └── zip.aspl ├── templates ├── README.md ├── linux │ ├── arm32 │ │ ├── full │ │ │ └── .gitignore │ │ └── minimal │ │ │ └── .gitignore │ └── x86_64 │ │ ├── full │ │ └── .gitignore │ │ └── minimal │ │ └── .gitignore ├── macos │ └── x86_64 │ │ ├── full │ │ └── .gitignore │ │ └── minimal │ │ └── .gitignore └── windows │ └── x86_64 │ ├── full │ └── cli │ │ └── .gitignore │ └── minimal │ └── .gitignore ├── tests ├── abstracts │ ├── Child.aspl │ ├── GrandParentOne.aspl │ ├── GrandParentTwo.aspl │ ├── Parent.aspl │ └── main.aspl ├── arithmetic │ └── arithmetic.aspl ├── attributes │ ├── Example.aspl │ └── main.aspl ├── blocks │ └── blocks.aspl ├── boolean_operators │ └── boolean_operators.aspl ├── break_and_continue │ └── break_and_continue.aspl ├── callbacks │ └── callbacks.aspl ├── casting │ └── casting.aspl ├── classes │ ├── Example.aspl │ ├── GrandParent.aspl │ ├── ParentOne.aspl │ ├── ParentTwo.aspl │ └── main.aspl ├── closures │ └── closures.aspl ├── compile_time │ └── compile_time.aspl ├── divideequals │ └── divideequals.aspl ├── enums │ ├── Options.aspl │ ├── Persons.aspl │ └── main.aspl ├── equality │ └── equality.aspl ├── folders │ ├── main.aspl │ ├── middle │ │ ├── deep │ │ │ └── deep.aspl │ │ └── middle.aspl │ └── top.aspl ├── foreach │ └── foreach.aspl ├── functions │ └── functions.aspl ├── hello_world │ └── hello_world.aspl ├── if │ └── if.aspl ├── implementation_calls │ └── implementation_calls.aspl ├── imports │ ├── classes │ │ └── Example.aspl │ └── main.aspl ├── lists │ └── lists.aspl ├── maps │ └── maps.aspl ├── methods │ └── methods.aspl ├── minusequals │ └── minusequals.aspl ├── minusminus │ └── minusminus.aspl ├── modules │ └── modules.aspl ├── moduloequals │ └── moduloequals.aspl ├── multiplyequals │ └── multiplyequals.aspl ├── nullable │ └── nullable.aspl ├── oftype │ └── oftype.aspl ├── parent_method_calls │ ├── Child.aspl │ ├── Parent.aspl │ └── main.aspl ├── plusequals │ └── plusequals.aspl ├── plusplus │ └── plusplus.aspl ├── pointers │ └── pointers.aspl ├── properties │ └── properties.aspl ├── properties_without_constructor │ ├── Example.aspl │ └── main.aspl ├── repeat │ └── repeat.aspl ├── statics │ ├── Child.aspl │ ├── Parent.aspl │ └── main.aspl ├── unicode │ └── unicode.aspl ├── variables │ └── variables.aspl └── while │ └── while.aspl └── thirdparty ├── appbundle ├── README.md ├── loader.c └── loader.h ├── cwsc ├── LICENSE ├── README.md ├── cwsc.h └── thirdparty │ ├── libtomcrypt.c │ ├── tlse.c │ ├── tlse.h │ └── tlse_adapter.c ├── echttp ├── LICENSE ├── README.md ├── echttp.h └── thirdparty │ ├── libtomcrypt.c │ ├── tlse.c │ ├── tlse.h │ └── tlse_adapter.c ├── hashmap ├── README.md └── hashmap.h ├── icylib ├── .gitignore ├── LICENSE ├── README.md ├── bresenham.h ├── color.h ├── examples │ ├── julia │ │ ├── julia.c │ │ └── julia_set.png │ ├── shapes │ │ ├── shapes.c │ │ └── shapes.png │ └── text │ │ ├── text.c │ │ └── text.png ├── file_utils.h ├── icylib.h ├── lazy_chunked_image.h ├── math_utils.h ├── primitive_chunked_image.h ├── regular_image.h ├── text.h ├── thick_xiaolin_wu.h └── thirdparty │ ├── stb_image.h │ ├── stb_image_resize2.h │ ├── stb_image_write.h │ └── stb_truetype.h ├── libgc ├── .gitignore ├── amalgamation.txt ├── gc.c └── include │ ├── gc.h │ └── gc │ ├── cord.h │ ├── cord_pos.h │ ├── ec.h │ ├── gc.h │ ├── gc_allocator.h │ ├── gc_backptr.h │ ├── gc_config_macros.h │ ├── gc_disclaim.h │ ├── gc_gcj.h │ ├── gc_inline.h │ ├── gc_mark.h │ ├── gc_pthread_redirects.h │ ├── gc_tiny_fl.h │ ├── gc_typed.h │ ├── gc_version.h │ ├── javaxfc.h │ └── leak_detector.h ├── miniz ├── ChangeLog.md ├── LICENSE ├── examples │ ├── example1.c │ ├── example2.c │ ├── example3.c │ ├── example4.c │ ├── example5.c │ └── example6.c ├── miniz.c ├── miniz.h └── readme.md ├── netutils ├── README.md ├── libtomcrypt.c ├── tcp_connection.c ├── tlse.c ├── tlse.h └── tlse_adapter.c ├── regexp ├── regexp.c └── regexp.h ├── sokol ├── .editorconfig ├── .github │ └── workflows │ │ ├── gen_bindings.yml │ │ └── main.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets │ ├── logo_full_large.png │ ├── logo_full_small.png │ ├── logo_s_large.png │ └── logo_s_small.png ├── bindgen │ ├── .gitignore │ ├── README.md │ ├── gen_all.py │ ├── gen_d.py │ ├── gen_ir.py │ ├── gen_nim.py │ ├── gen_odin.py │ ├── gen_rust.py │ ├── gen_util.py │ └── gen_zig.py ├── fips.yml ├── sokol_app.h ├── sokol_args.h ├── sokol_audio.h ├── sokol_fetch.h ├── sokol_gfx.h ├── sokol_glue.h ├── sokol_log.h ├── sokol_time.h ├── tests │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── analyze_ios.sh │ ├── analyze_linux.sh │ ├── analyze_macos.sh │ ├── analyze_win.cmd │ ├── compile │ │ ├── CMakeLists.txt │ │ ├── sokol_app.c │ │ ├── sokol_app.cc │ │ ├── sokol_args.c │ │ ├── sokol_args.cc │ │ ├── sokol_audio.c │ │ ├── sokol_audio.cc │ │ ├── sokol_color.c │ │ ├── sokol_color.cc │ │ ├── sokol_debugtext.c │ │ ├── sokol_debugtext.cc │ │ ├── sokol_fetch.c │ │ ├── sokol_fetch.cc │ │ ├── sokol_fontstash.c │ │ ├── sokol_fontstash.cc │ │ ├── sokol_gfx.c │ │ ├── sokol_gfx.cc │ │ ├── sokol_gfx_imgui.c │ │ ├── sokol_gfx_imgui.cc │ │ ├── sokol_gl.c │ │ ├── sokol_gl.cc │ │ ├── sokol_glue.c │ │ ├── sokol_glue.cc │ │ ├── sokol_imgui.c │ │ ├── sokol_imgui.cc │ │ ├── sokol_log.c │ │ ├── sokol_log.cc │ │ ├── sokol_main.c │ │ ├── sokol_main.cc │ │ ├── sokol_nuklear.c │ │ ├── sokol_shape.c │ │ ├── sokol_shape.cc │ │ ├── sokol_spine.c │ │ ├── sokol_spine.cc │ │ ├── sokol_time.c │ │ └── sokol_time.cc │ ├── ext │ │ ├── CMakeLists.txt │ │ ├── fontstash.h │ │ ├── nuklear.c │ │ ├── nuklear.h │ │ └── stb_truetype.h │ ├── functional │ │ ├── CMakeLists.txt │ │ ├── README.txt │ │ ├── assets │ │ │ ├── comsi.s3m │ │ │ └── readme.txt │ │ ├── force_dummy_backend.h │ │ ├── sokol_args_test.c │ │ ├── sokol_audio_test.c │ │ ├── sokol_color_test.c │ │ ├── sokol_debugtext_test.c │ │ ├── sokol_fetch_test.c │ │ ├── sokol_gfx_test.c │ │ ├── sokol_gl_test.c │ │ ├── sokol_log_test.c │ │ ├── sokol_shape_test.c │ │ ├── sokol_spine_test.c │ │ ├── sokol_test.c │ │ └── utest.h │ ├── test_android.sh │ ├── test_common.sh │ ├── test_emscripten.sh │ ├── test_ios.sh │ ├── test_linux.sh │ ├── test_macos.sh │ └── test_win.cmd └── util │ ├── gen_sokol_color.py │ ├── sokol_color.h │ ├── sokol_debugtext.h │ ├── sokol_fontstash.h │ ├── sokol_gfx_imgui.h │ ├── sokol_gl.h │ ├── sokol_imgui.h │ ├── sokol_memtrack.h │ ├── sokol_nuklear.h │ ├── sokol_shape.h │ └── sokol_spine.h ├── sqlite └── sqlite3.c ├── ssl ├── LICENSE ├── README.md ├── glbind.h └── linux │ ├── bin │ └── libssl.a │ ├── build.sh │ ├── glbind_dummies.c │ ├── sokol_gfx.h │ ├── ssl.c │ ├── ssl.h │ └── x11_dummies.c └── thread.h ├── README.md └── thread.h /.gitattributes: -------------------------------------------------------------------------------- 1 | *.aspl linguist-language=ASPL text=auto eol=lf 2 | *.v linguist-language=V text=auto eol=lf 3 | **/v.mod linguist-language=V text=auto eol=lf -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Discussion Q&A 4 | url: https://github.com/aspl-lang/aspl/discussions/categories/q-a 5 | about: You can ask and answer questions here 6 | - name: Discord server 7 | url: https://discord.gg/UUNzAFrKU2 8 | about: You can report bugs, suggest features, ask and answer questions, and more here -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.yml: -------------------------------------------------------------------------------- 1 | name: Question 2 | description: Ask a question about ASPL 3 | title: "module: concise question" 4 | labels: help wanted, question, unreviewed 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for taking an interest in ASPL! 10 | Please note the [conventions for naming issues in the ASPL monorepo](https://github.com/aspl-lang/aspl/blob/main/CONTRIBUTING.md#conventions-in-the-aspl-monorepo) for information on how to choose a good title. 11 | - type: textarea 12 | id: question 13 | attributes: 14 | label: Question 15 | description: Ask your question here. 16 | validations: 17 | required: true 18 | - type: checkboxes 19 | id: terms 20 | attributes: 21 | label: Contributing guidelines 22 | description: I have read the [contributing guidelines](https://github.com/aspl-lang/aspl/blob/main/CONTRIBUTING.md) and verified that his bug has not been asked previously. 23 | options: 24 | - label: I agree to follow this project's contributing guidelines 25 | required: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !*.* 3 | !*/ 4 | !LICENSE 5 | *.exe 6 | *.exe.lib 7 | *.dll 8 | *.pdb 9 | /*.c 10 | *.def 11 | *.apk 12 | *.ail 13 | *.log -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) The ASPL contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /cli/utils/version.aspl: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | function get_git_sha() returns string{ 4 | var wd = os.getwd() 5 | os.chdir(io.full_directory_path(io.get_executable_path())) 6 | var sha = os.execute("git rev-parse --short HEAD").output.trim() 7 | os.chdir(wd) 8 | return sha 9 | } 10 | 11 | function get_current_version() returns string{ 12 | var string nextRelease = "0.2" 13 | var bool isDevelopementBuild = true 14 | if(isDevelopementBuild){ 15 | return "v" + nextRelease + "-" + get_git_sha() 16 | }else{ 17 | return "v" + nextRelease 18 | } 19 | } -------------------------------------------------------------------------------- /examples/consonants_and_vowels/main.aspl: -------------------------------------------------------------------------------- 1 | var string input = input("Enter a string: ") 2 | 3 | var int consonants = 0 4 | var int vowels = 0 5 | 6 | foreach(input as c){ 7 | if(["a", "e", "i", "o", "u"].contains(c)){ 8 | vowels++ 9 | }else{ 10 | consonants++ 11 | } 12 | } 13 | 14 | print("Consonants: " + consonants) 15 | print("Vowels: " + vowels) -------------------------------------------------------------------------------- /examples/double_pendulum/Pendulum.aspl: -------------------------------------------------------------------------------- 1 | class Pendulum { 2 | 3 | property float g = 9.81 4 | property float dt = 0.05 5 | 6 | [readpublic] 7 | property double angle 8 | [readpublic] 9 | property double angVel = 0 10 | property double angAcc = 0 11 | property double length 12 | property double mass 13 | 14 | [public] 15 | method construct(double angle, double length, double mass){ 16 | this.angle = angle 17 | this.length = length 18 | this.mass = mass 19 | } 20 | 21 | [public] 22 | method update1(){ 23 | this.angAcc = (-g / this.length) * math.sin(this.angle) 24 | this.angVel += this.angAcc * dt 25 | this.angle += this.angVel * dt 26 | } 27 | 28 | [public] 29 | method update2(double angle1, double angVel1, double length1, double mass1){ 30 | var num1 = -g * (2 * this.mass + mass1) * math.sin(this.angle) 31 | var num2 = -this.mass * g * math.sin(this.angle - 2 * angle1) 32 | var num3 = -2 * math.sin(this.angle - angle1) * this.mass 33 | var num4 = angVel1 * angVel1 * length1 + this.angVel * this.angVel * this.length * math.cos(this.angle - angle1) 34 | var den = length1 * (2 * this.mass + mass1 - this.mass * math.cos(2 * this.angle - 2 * angle1)) 35 | 36 | this.angAcc = (num1 + num2 + num3 * num4) / den 37 | this.angVel += this.angAcc * dt 38 | this.angle += this.angVel * dt 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /examples/fahrenheit_to_celsius/main.aspl: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | function fahrenheit_to_celsius(float degrees) returns float{ 4 | return (degrees - 32) * (5f / 9) 5 | } 6 | 7 | var fahrenheit = float(math.round(double(float(input("Enter a temperature in °F: "))), 2)) 8 | var celsius = math.round(double(fahrenheit_to_celsius(fahrenheit)), 2) 9 | print(fahrenheit + "°F ≙ " + celsius + "°C") -------------------------------------------------------------------------------- /examples/fibonacci_numbers/main.aspl: -------------------------------------------------------------------------------- 1 | var long a = 1 2 | var long b = 0 3 | var long n = 0 4 | 5 | while(true){ 6 | n = a + b 7 | if(n < 0){ 8 | print("The program reached the maximum fibonacci number it can store.") 9 | exit(0) 10 | } 11 | print(n) 12 | b = a 13 | a = n 14 | } -------------------------------------------------------------------------------- /examples/hello_world/main.aspl: -------------------------------------------------------------------------------- 1 | print("Hello World!") -------------------------------------------------------------------------------- /examples/json_basics/main.aspl: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | var list l = list["Hello", "World", 1, 2, true] 4 | print(json.encode(l)) 5 | 6 | var map m = map{"Hello" => "World", "x" => 1, "y" => 2, "b" => true} 7 | print(json.encode(m, true)) // true for pretty print -------------------------------------------------------------------------------- /examples/julia_set/main.aspl: -------------------------------------------------------------------------------- 1 | // Original code taken and translated from: https://www.geeksforgeeks.org/julia-fractal-python/ 2 | 3 | import graphics 4 | 5 | var int width = 500 6 | var int height = 500 7 | var float zoom = 1f 8 | 9 | var Canvas canvas = new Canvas(500, 500) 10 | canvas.fill(new Color(255b, 255b, 255b, 255b), false) 11 | 12 | var float cX = -0.7 13 | var float cY = 0.27015 14 | var float moveX = 0f 15 | var float moveY = 0f 16 | var int maxIterations = 255 17 | 18 | repeat(width, x = 0){ 19 | repeat(height, y = 0){ 20 | var zx = 1.5 * (x - width / 2f) / (0.5 * zoom * width) + moveX 21 | var zy = 1.5 * (y - height / 2f) / (0.5 * zoom * height) + moveY 22 | var int i = maxIterations 23 | while((zx * zx + zy * zy) < 4 && i > 1){ 24 | var temp = zx * zx - zy * zy + cX 25 | zy = 2 * zx * zy + cY 26 | zx = temp 27 | i-- 28 | } 29 | canvas.setPixel(x, y, Color:fromRGB(byte(i * 4), byte(i * 4), byte(i * 4))) 30 | } 31 | } 32 | 33 | canvas.save("julia_set.png") -------------------------------------------------------------------------------- /examples/quicksort/main.aspl: -------------------------------------------------------------------------------- 1 | function quicksort(list l) returns list{ 2 | if(l.length < 2){ 3 | return l 4 | } 5 | 6 | var float pivot = l[l.length / 2] 7 | 8 | var list left = [] 9 | var list right = [] 10 | var list equal = [] 11 | 12 | foreach(l as element){ 13 | if(element < pivot){ 14 | left.add(element) 15 | } elseif(element == pivot){ 16 | equal.add(element) 17 | } else { 18 | right.add(element) 19 | } 20 | } 21 | 22 | left = quicksort(left) 23 | right = quicksort(right) 24 | 25 | var list result = [] 26 | foreach(left as element){ 27 | result.add(element) 28 | } 29 | foreach(equal as element){ 30 | result.add(element) 31 | } 32 | foreach(right as element){ 33 | result.add(element) 34 | } 35 | 36 | return result 37 | } 38 | 39 | var list l1 = input("Enter a list of numbers you want to sort: ").split(",") 40 | var list l2 = [] 41 | foreach(l1 as element){ 42 | l2.add(float(element.trim())) 43 | } 44 | print("Unsorted: " + l2) 45 | print("Sorted: " + quicksort(l2)) -------------------------------------------------------------------------------- /examples/sqlite_basics/main.aspl: -------------------------------------------------------------------------------- 1 | import sqlite 2 | 3 | var db = new Database(":memory:") 4 | db.query("CREATE TABLE friends (id INTEGER PRIMARY KEY, name TEXT NOT NULL, age INTEGER NOT NULL)") 5 | 6 | db.query("INSERT INTO friends (name, age) VALUES ('Tom', 18)") 7 | 8 | var statement = db.prepare("INSERT INTO friends (name, age) VALUES (:name, :age)") 9 | statement.bind(":name", "Rebecca") 10 | statement.bind(":age", 30) 11 | statement.execute() 12 | 13 | print(db.query("SELECT * FROM friends").fetchRows()) 14 | 15 | statement = db.prepare("SELECT age FROM friends WHERE name = :name") 16 | statement.bind(":name", "Tom") 17 | print("Tom is " + statement.execute().fetchRow()["age"] + " years old!") 18 | 19 | db.close() -------------------------------------------------------------------------------- /examples/usd_to_euro/main.aspl: -------------------------------------------------------------------------------- 1 | import internet 2 | import json 3 | import math 4 | 5 | var usd = math.round(double(input("Enter a value of $ you want to convert to €: ")), 2) 6 | var data = map(json.decode(internet.get("http://open.er-api.com/v6/latest/USD").text)) // TODO: Use https here when it works 7 | var rates = map(data["rates"]) 8 | var rate = rates["EUR"] 9 | var euro = math.round(usd * rate, 2) 10 | print(usd + "$ ≙ " + euro + "€") -------------------------------------------------------------------------------- /runtime/ailinterpreter/README.md: -------------------------------------------------------------------------------- 1 | # AIL Bytecode Interpreter 2 | This is a simple AIL bytecode interpreter, implemented in C. 3 | 4 | It partially uses the C backend template as its runtime library. 5 | 6 | TODO: Clean & speed up the code. 7 | 8 | ## Dependencies 9 | * `stdlib/backend/stringcode/c/template.c` as well as all of its dependencies 10 | * `thirdparty/appbundle` (only when building the interpreter as a standalone application, i.e. `-DASPL_AILI_BUNDLED`) -------------------------------------------------------------------------------- /runtime/ailinterpreter/byte_list.h: -------------------------------------------------------------------------------- 1 | #ifndef ASPL_AILI_BYTE_LIST_H_INCLUDED 2 | #define ASPL_AILI_BYTE_LIST_H_INCLUDED 3 | 4 | #include "instructions.h" 5 | 6 | typedef struct ASPL_AILI_ByteList { 7 | long long size; 8 | long long position; 9 | unsigned char* data; 10 | } ASPL_AILI_ByteList; 11 | 12 | ASPL_AILI_ByteList* aspl_ailinterpreter_bytelist_clone(ASPL_AILI_ByteList* old); 13 | 14 | unsigned char aspl_ailinterpreter_read_byte(ASPL_AILI_ByteList* bytes); 15 | 16 | unsigned char aspl_ailinterpreter_peek_byte(ASPL_AILI_ByteList* bytes); 17 | 18 | ASPL_AILI_Instruction aspl_ailinterpreter_fetch_instruction(ASPL_AILI_ByteList* bytes); 19 | 20 | ASPL_AILI_Instruction aspl_ailinterpreter_peek_instruction(ASPL_AILI_ByteList* bytes); 21 | 22 | unsigned char aspl_ailinterpreter_read_bool(ASPL_AILI_ByteList* bytes); 23 | 24 | short aspl_ailinterpreter_read_short(ASPL_AILI_ByteList* bytes); 25 | 26 | int aspl_ailinterpreter_read_int(ASPL_AILI_ByteList* bytes); 27 | 28 | long long aspl_ailinterpreter_read_long(ASPL_AILI_ByteList* bytes); 29 | 30 | float aspl_ailinterpreter_read_float(ASPL_AILI_ByteList* bytes); 31 | 32 | double aspl_ailinterpreter_read_double(ASPL_AILI_ByteList* bytes); 33 | 34 | char* aspl_ailinterpreter_read_short_string(ASPL_AILI_ByteList* bytes); 35 | 36 | char* aspl_ailinterpreter_read_long_string(ASPL_AILI_ByteList* bytes); 37 | 38 | #endif -------------------------------------------------------------------------------- /stdlib/appbundle/Workaround.aspl: -------------------------------------------------------------------------------- 1 | //Needed because of a bug in the real_path function of the V standard library. -------------------------------------------------------------------------------- /stdlib/aspl/README.md: -------------------------------------------------------------------------------- 1 | # The ASPL compiler & co. 2 | ## Overview 3 | This module contains submodules for the `parser`, `compiler` and `formatter` of the ASPL toolchain. 4 |
It can be imported and used like any other ASPL module and has no dependencies[^1] except for other modules of the standard library. 5 |
Note that this module does not contain any CLI functionality, but it is instead imported and used by the `cli` folder in the root directory of the ASPL project, which implements the `aspl` command along with all its subcommands. 6 | 7 | [^1]: The compiler requires pre-compiled binary templates when packaging ASPL programs into an executable. Refer to the `templates` folder in the root directory of the ASPL project for more information. 8 | 9 | ## Example usage 10 | ```aspl 11 | import aspl.compiler 12 | 13 | aspl.compiler.compile("hello.aspl") 14 | ``` 15 | That's it. You can now run the compiled program by executing `./hello` (or `hello` if you're on Windows). 16 | 17 | For configuration options and more information, please refer to the `parser` and `compiler` submodules. -------------------------------------------------------------------------------- /stdlib/aspl/compiler/CompilationResult.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | 3 | [public] 4 | class CompilationResult { 5 | 6 | [readpublic] 7 | property list output 8 | 9 | [public] 10 | method construct(list output){ 11 | this.output = output 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/Backend.aspl: -------------------------------------------------------------------------------- 1 | import aspl.compiler 2 | import aspl.parser 3 | 4 | [public] 5 | [abstract] 6 | class Backend { 7 | 8 | [public] 9 | [abstract] 10 | method compile(ParserResult result) returns CompilationResult 11 | 12 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/bytecode/IntType.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | enum IntType { 3 | Short, 4 | Int, 5 | Long 6 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/bytecode/ail/TypeUtils.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | [static] 3 | class TypeUtils { 4 | 5 | [public] 6 | [static] 7 | method shortName(string s) returns string{ 8 | if(s == "integer"){ 9 | return "int" 10 | }elseif(s == "boolean"){ 11 | return "bool" 12 | }else{ 13 | return s 14 | } 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/bytecode/twail/Instruction.aspl: -------------------------------------------------------------------------------- 1 | enum Instruction { 2 | Manifest, 3 | CreateObject, 4 | Implement, 5 | CreatePair, 6 | DeclareFunction, 7 | CallFunction, 8 | IfStatement, 9 | IfElseStatement, 10 | WhileStatement, 11 | RepeatStatement, 12 | ForeachStatement, 13 | Add, 14 | Subtract, 15 | Multiply, 16 | Divide, 17 | Modulo, 18 | LessThan, 19 | LessEqual, 20 | GreaterThan, 21 | GreaterEqual, 22 | Equals, 23 | And, 24 | Or, 25 | Xor, 26 | RegisterVariable, 27 | AccessVariable, 28 | UpdateVariable, 29 | DeclareMethod, 30 | CallMethod, 31 | BreakStatement, 32 | ContinueStatement, 33 | ReturnStatement, 34 | FallbackStatement, 35 | EscapeStatement, 36 | Negate, 37 | IndexCollection, 38 | UpdateCollection, 39 | DeclareCallback, 40 | DeclareClass, 41 | NewStatement, 42 | ThisStatement, 43 | DeclareProperty, 44 | AccessProperty, 45 | UpdateProperty, 46 | DeclareEnum, 47 | EnumField, 48 | DeclarePointer, 49 | DereferencePointer, 50 | Cast, 51 | Assert, 52 | OfType, 53 | Throw, 54 | Catch, 55 | PropagateError 56 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/bytecode/twail/TypeUtils.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | [static] 3 | class TypeUtils { 4 | 5 | [public] 6 | [static] 7 | method shortName(string s) returns string{ 8 | if(s == "integer"){ 9 | return "int" 10 | }elseif(s == "boolean"){ 11 | return "bool" 12 | }else{ 13 | return s 14 | } 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/stringcode/c/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | !template.c -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/stringcode/c/CallbackDeclaration.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast.literals 2 | 3 | class CallbackDeclaration { 4 | 5 | [public] 6 | [static] 7 | property int _id 8 | 9 | [readpublic] 10 | property CallbackLiteral literal 11 | [readpublic] 12 | property int id 13 | 14 | method construct(CallbackLiteral literal){ 15 | this.literal = literal 16 | this.id = self:_id++ 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/stringcode/c/CatchBlockDeclaration.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast.literals 2 | import aspl.parser.ast.expressions 3 | 4 | class CatchBlockDeclaration { 5 | 6 | [public] 7 | [static] 8 | property int _id 9 | 10 | [readpublic] 11 | property CatchExpression block 12 | [readpublic] 13 | property int id 14 | 15 | method construct(CatchExpression block){ 16 | this.block = block 17 | this.id = self:_id++ 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/stringcode/c/IdentifierEscapeUtils.aspl: -------------------------------------------------------------------------------- 1 | [static] 2 | class IdentifierEscapeUtils { 3 | 4 | [static] 5 | property list reservedIdentifiers = [ 6 | "auto", 7 | "break", 8 | "case", 9 | "char", 10 | "const", 11 | "continue", 12 | "default", 13 | "do", 14 | "double", 15 | "else", 16 | "enum", 17 | "extern", 18 | "float", 19 | "for", 20 | "goto", 21 | "if", 22 | "int", 23 | "long", 24 | "register", 25 | "return", 26 | "short", 27 | "signed", 28 | "sizeof", 29 | "static", 30 | "struct", 31 | "switch", 32 | "typedef", 33 | "union", 34 | "unsigned", 35 | "void", 36 | "volatile", 37 | "while" 38 | ] 39 | 40 | [public] 41 | [static] 42 | method escapeIdentifier(string identifier) returns string{ 43 | if(reservedIdentifiers.contains(identifier)){ 44 | return "_escaped_" + identifier 45 | } 46 | return identifier 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/backend/stringcode/c/TypeUtils.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | [static] 3 | class TypeUtils { 4 | 5 | [public] 6 | [static] 7 | method shortName(string s) returns string{ 8 | if(s == "integer"){ 9 | return "int" 10 | }elseif(s == "boolean"){ 11 | return "bool" 12 | }else{ 13 | return s 14 | } 15 | } 16 | 17 | [public] 18 | [static] 19 | method typeToCIdentifier(string type) returns string{ 20 | return type.replace(".", "$").replace("|", "_OR_").replace("<", "_").replace(">", "_").replace(", ", "_").replace(" ", "_") 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/utils/IncludeUtils.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | [static] 3 | class IncludeUtils { 4 | 5 | [public] 6 | [static] 7 | [threadlocal] 8 | property list files 9 | 10 | [public] 11 | [static] 12 | method include(string file) { 13 | if(files.contains(file)) { 14 | return 15 | } 16 | files.add(file) 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/utils/LinkUtils.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | [static] 3 | class LinkUtils { 4 | 5 | [public] 6 | [static] 7 | [threadlocal] 8 | property list libraries 9 | 10 | } -------------------------------------------------------------------------------- /stdlib/aspl/compiler/utils/templates.aspl: -------------------------------------------------------------------------------- 1 | import io 2 | import os 3 | import aspl.parser.utils 4 | 5 | [public] 6 | function choose_executable_template(string os, Architecture arch, string internalTemplateType, bool gui) returns string{ 7 | var baseTemplatePath = io.join_path([io.full_directory_path(io.get_executable_path()), "templates"]) 8 | var archName = architecture_to_folder_name(arch) 9 | if(os == "windows"){ 10 | if(internalTemplateType == "minimal"){ 11 | return io.join_path([baseTemplatePath, "windows", archName, internalTemplateType, "Template.exe"]) 12 | }elseif(gui){ 13 | return io.join_path([baseTemplatePath, "windows", archName, internalTemplateType, "gui", "Template.exe"]) 14 | }else{ 15 | return io.join_path([baseTemplatePath, "windows", archName, internalTemplateType, "cli", "Template.exe"]) 16 | } 17 | }else{ 18 | return io.join_path([baseTemplatePath, os, archName, internalTemplateType, "Template"]) 19 | } 20 | } 21 | 22 | function architecture_to_folder_name(Architecture arch) returns string{ 23 | if(arch == Architecture.amd64){ 24 | return "x86_64" 25 | }elseif(arch == Architecture.i386){ 26 | return "x86_32" 27 | }else{ 28 | return string(arch) 29 | } 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/Module.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class Module { 3 | 4 | [public] 5 | [static] 6 | [threadlocal] 7 | property map modules = map{} 8 | [public] 9 | [static] 10 | [threadlocal] 11 | property Module mainModule 12 | [readpublic] 13 | [static] 14 | [threadlocal] 15 | property bool initialized = false 16 | 17 | [public] 18 | [static] 19 | method init(Module mainModule){ 20 | self:mainModule = mainModule 21 | self:modules = {self:mainModule.name => self:mainModule} 22 | self:initialized = true 23 | } 24 | 25 | [readpublic] 26 | property string name 27 | [public] 28 | property string id{ 29 | get{ 30 | return name.toLower() 31 | } 32 | } 33 | [readpublic] 34 | property string directory 35 | 36 | [public] 37 | method construct(string name, string directory){ 38 | this.name = name 39 | this.directory = directory 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ParseFileResult.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | 3 | [public] 4 | class ParseFileResult { 5 | 6 | [readpublic] 7 | property list nodes 8 | 9 | [public] 10 | method construct(list nodes){ 11 | this.nodes = nodes 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ParserResult.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | 3 | [public] 4 | class ParserResult { 5 | 6 | [readpublic] 7 | property list nodes 8 | 9 | [public] 10 | method construct(list nodes){ 11 | this.nodes = nodes 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/Node.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser 2 | import aspl.parser.utils 3 | 4 | [public] 5 | [abstract] 6 | class Node{ 7 | 8 | [readpublic] 9 | property Location? location = null 10 | 11 | [public] 12 | method construct(Location? location){ 13 | this.location = location 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/AndExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.utils 2 | 3 | [public] 4 | class AndExpression extends BinaryOperator { 5 | 6 | [public] 7 | method construct(Expression left, Expression right, Location? location){ 8 | parent(BinaryOperator).construct(left, right, location) 9 | } 10 | 11 | [public] 12 | method getType() returns Types{ 13 | return this.left.getType() 14 | } 15 | 16 | [public] 17 | method getConstantValue() returns any{ 18 | return this.left.getConstantValue() && this.right.getConstantValue() 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/BinaryOperator.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | [abstract] 6 | class BinaryOperator extends Expression { 7 | 8 | [readpublic] 9 | property Expression left 10 | [readpublic] 11 | property Expression right 12 | 13 | [public] 14 | method construct(Expression left, Expression right, Location? location){ 15 | parent(Node).construct(location) 16 | this.left = left 17 | this.right = right 18 | } 19 | 20 | [public] 21 | method isConstant() returns bool{ 22 | if(left.isConstant()){ 23 | if(right.isConstant()){ 24 | return true 25 | } 26 | else{ 27 | return false 28 | } 29 | } 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/CastExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class CastExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression value 9 | [readpublic] 10 | property Type type 11 | 12 | [public] 13 | method construct(Expression value, Type type, Location? location){ 14 | parent(Node).construct(location) 15 | this.value = value 16 | this.type = type 17 | } 18 | 19 | [public] 20 | method getType() returns Types{ 21 | return new Types([this.type]) 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/CatchExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class CatchExpression extends Expression { 7 | 8 | [readpublic] 9 | property Expression expression 10 | [readpublic] 11 | property string? variable 12 | [readpublic] 13 | property list code 14 | [readpublic] 15 | property list capturedVariables 16 | [readpublic] 17 | property bool standalone 18 | 19 | [public] 20 | method construct(Expression expression, string? variable, list code, list capturedVariables, bool standalone, Location? location){ 21 | parent(Node).construct(location) 22 | this.expression = expression 23 | this.variable = variable 24 | this.code = code 25 | this.capturedVariables = capturedVariables 26 | this.standalone = standalone 27 | } 28 | 29 | [public] 30 | method getType() returns Types{ 31 | return this.expression.getType() 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/CheckEqualsExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class CheckEqualsExpression extends BinaryOperator { 6 | 7 | [public] 8 | method construct(Expression left, Expression right, Location? location){ 9 | parent(BinaryOperator).construct(left, right, location) 10 | } 11 | 12 | [public] 13 | method getType() returns Types{ 14 | return new Types([Type:fromString("boolean")]) 15 | } 16 | 17 | [public] 18 | method getConstantValue() returns any{ 19 | return this.left.getConstantValue() == this.right.getConstantValue() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/ClassInstantiateExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | import aspl.parser.classes 4 | 5 | [public] 6 | class ClassInstantiateExpression extends Expression { 7 | 8 | [readpublic] 9 | property Class c 10 | [readpublic] 11 | property list arguments 12 | 13 | [public] 14 | method construct(Class c, list arguments, Location? location){ 15 | parent(Node).construct(location) 16 | this.c = c 17 | this.arguments = arguments 18 | } 19 | 20 | [public] 21 | method getType() returns Types{ 22 | return new Types([this.c.type]) 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/DereferenceExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class DereferenceExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression pointer 9 | 10 | [public] 11 | method construct(Expression pointer, Location? location){ 12 | parent(Node).construct(location) 13 | this.pointer = pointer 14 | } 15 | 16 | [public] 17 | method getType() returns Types{ 18 | return this.pointer.getType().getReferenced() 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/EmbedFileExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class EmbedFileExpression extends Expression { 6 | 7 | [readpublic] 8 | property string file 9 | 10 | method construct(string file, Location? location){ 11 | parent(Node).construct(location) 12 | this.file = file 13 | } 14 | 15 | [public] 16 | method getType() returns Types{ 17 | return new Types([Type:fromString("list")]) 18 | } 19 | 20 | [public] 21 | method isConstant() returns bool{ 22 | return true 23 | } 24 | 25 | [public] 26 | method getConstantValue() returns any{ 27 | return io.read_file_bytes(file) 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/EnumFieldAccessExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.enums 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class EnumFieldAccessExpression extends Expression { 7 | 8 | [readpublic] 9 | property EnumField field 10 | 11 | method construct(EnumField field, Location? location){ 12 | parent(Node).construct(location) 13 | this.field = field 14 | } 15 | 16 | [public] 17 | method getType() returns Types{ 18 | return new Types([this.field.e.type]) 19 | } 20 | 21 | [public] 22 | method isConstant() returns bool{ 23 | return true 24 | } 25 | 26 | [public] 27 | method getConstantValue() returns any{ 28 | return field.value 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/Expression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | // This class is for all nodes that may be used as expressions 5 | [public] 6 | [abstract] 7 | class Expression extends Node{ 8 | 9 | [public] 10 | [abstract] 11 | method getType() returns Types 12 | 13 | [public] 14 | method isConstant() returns bool{ 15 | return false 16 | } 17 | 18 | [public] 19 | method getConstantValue() returns any{ 20 | aspl.parser.utils.fatal_error("This expression is not constant") 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/FunctionCallExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.functions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class FunctionCallExpression extends Expression{ 7 | 8 | [readpublic] 9 | property string identifier 10 | [readpublic] 11 | property Function func 12 | [readpublic] 13 | property list arguments 14 | [readpublic] 15 | property bool newThread 16 | 17 | method construct(string identifier, Function func, list arguments, bool newThread, Location? location){ 18 | parent(Node).construct(location) 19 | this.identifier = identifier 20 | this.func = func 21 | this.arguments = arguments 22 | this.newThread = newThread 23 | } 24 | 25 | [public] 26 | method getType() returns Types{ 27 | return this.func.returnTypes 28 | } 29 | 30 | [public] 31 | method isConstant() returns bool{ 32 | return false 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/GreaterThanExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class GreaterThanExpression extends BinaryOperator { 6 | 7 | [public] 8 | method construct(Expression left, Expression right, Location? location){ 9 | parent(BinaryOperator).construct(left, right, location) 10 | } 11 | 12 | [public] 13 | method getType() returns Types{ 14 | return new Types([Type:fromString("boolean")]) 15 | } 16 | 17 | [public] 18 | method getConstantValue() returns any{ 19 | return this.left.getConstantValue() > this.right.getConstantValue() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/GreaterThanOrEqualExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class GreaterThanOrEqualExpression extends BinaryOperator { 6 | 7 | [public] 8 | method construct(Expression left, Expression right, Location? location){ 9 | parent(BinaryOperator).construct(left, right, location) 10 | } 11 | 12 | [public] 13 | method getType() returns Types{ 14 | return new Types([Type:fromString("boolean")]) 15 | } 16 | 17 | [public] 18 | method getConstantValue() returns any{ 19 | return this.left.getConstantValue() >= this.right.getConstantValue() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/ImplementationCallExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.functions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class ImplementationCallExpression extends Expression{ 7 | 8 | [readpublic] 9 | property string call 10 | [readpublic] 11 | property list arguments 12 | 13 | method construct(string call, list arguments, Location? location){ 14 | parent(Node).construct(location) 15 | this.call = call 16 | this.arguments = arguments 17 | } 18 | 19 | [public] 20 | method getType() returns Types{ 21 | return new Types([Type:fromString("any")]) 22 | } 23 | 24 | [public] 25 | method isConstant() returns bool{ 26 | return false 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/LessThanExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class LessThanExpression extends BinaryOperator { 6 | 7 | [public] 8 | method construct(Expression left, Expression right, Location? location){ 9 | parent(BinaryOperator).construct(left, right, location) 10 | } 11 | 12 | [public] 13 | method getType() returns Types{ 14 | return new Types([Type:fromString("boolean")]) 15 | } 16 | 17 | [public] 18 | method getConstantValue() returns any{ 19 | return this.left.getConstantValue() < this.right.getConstantValue() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/LessThanOrEqualExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class LessThanOrEqualExpression extends BinaryOperator { 6 | 7 | [public] 8 | method construct(Expression left, Expression right, Location? location){ 9 | parent(BinaryOperator).construct(left, right, location) 10 | } 11 | 12 | [public] 13 | method getType() returns Types{ 14 | return new Types([Type:fromString("boolean")]) 15 | } 16 | 17 | [public] 18 | method getConstantValue() returns any{ 19 | return this.left.getConstantValue() <= this.right.getConstantValue() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/ListAssignExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class ListAssignExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression base 9 | [readpublic] 10 | property Expression index 11 | [readpublic] 12 | property Expression value 13 | 14 | [public] 15 | method construct(Expression base, Expression index, Expression value, Location? location){ 16 | parent(Node).construct(location) 17 | this.base = base 18 | this.index = index 19 | this.value = value 20 | } 21 | 22 | [public] 23 | method getType() returns Types{ 24 | return this.base.getType() 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/ListIndexExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class ListIndexExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression base 9 | [readpublic] 10 | property Expression index 11 | 12 | [public] 13 | method construct(Expression base, Expression index, Location? location){ 14 | parent(Node).construct(location) 15 | this.base = base 16 | this.index = index 17 | } 18 | 19 | [public] 20 | method getType() returns Types{ 21 | var list types = [] 22 | foreach(base.getType().types as type){ 23 | if(Type:getGenericTypes(type.toString()).length > 0){ 24 | foreach(Type:getGenericTypes(type.toString())[0].types as t){ 25 | types.add(t) 26 | } 27 | } 28 | } 29 | return new Types(types) 30 | } 31 | 32 | [public] 33 | method isConstant() returns bool{ 34 | return this.base.isConstant() && this.index.isConstant() 35 | } 36 | 37 | [public] 38 | method getConstantValue() returns any{ 39 | return list(this.base.getConstantValue())[int(this.index.getConstantValue())] 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/MapAccessExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class MapAccessExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression base 9 | [readpublic] 10 | property Expression key 11 | 12 | [public] 13 | method construct(Expression base, Expression key, Location? location){ 14 | parent(Node).construct(location) 15 | this.base = base 16 | this.key = key 17 | } 18 | 19 | [public] 20 | method getType() returns Types{ 21 | var list types = [] 22 | foreach(base.getType().types as type){ 23 | if(Type:getGenericTypes(type.toString()).length > 1){ 24 | foreach(Type:getGenericTypes(type.toString())[1].types as t){ 25 | types.add(t) 26 | } 27 | } 28 | } 29 | return new Types(types) 30 | } 31 | 32 | [public] 33 | method isConstant() returns bool{ 34 | return this.base.isConstant() && this.key.isConstant() 35 | } 36 | 37 | [public] 38 | method getConstantValue() returns any{ 39 | return map(this.base.getConstantValue())[this.key.getConstantValue()] 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/MapAssignExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class MapAssignExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression base 9 | [readpublic] 10 | property Expression key 11 | [readpublic] 12 | property Expression value 13 | 14 | [public] 15 | method construct(Expression base, Expression key, Expression value, Location? location){ 16 | parent(Node).construct(location) 17 | this.base = base 18 | this.key = key 19 | this.value = value 20 | } 21 | 22 | [public] 23 | method getType() returns Types{ 24 | return this.base.getType() 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/NegateExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class NegateExpression extends UnaryOperator { 6 | 7 | [public] 8 | method construct(Expression expression, Location? location){ 9 | parent(UnaryOperator).construct(expression, location) 10 | } 11 | 12 | [public] 13 | method getType() returns Types{ 14 | return new Types([Type:fromString("boolean")]) 15 | } 16 | 17 | [public] 18 | method getConstantValue() returns any{ 19 | return !this.expression.getConstantValue() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/NonStaticMethodCallExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.methods 3 | import aspl.parser.utils 4 | import aspl.parser.classes 5 | 6 | class NonStaticMethodCallExpression extends Expression{ 7 | 8 | [readpublic] 9 | property Method m 10 | [readpublic] 11 | property Expression base 12 | [readpublic] 13 | property Class? exactClass 14 | [readpublic] 15 | property list arguments 16 | [readpublic] 17 | property bool newThread 18 | 19 | method construct(Method m, Expression base, Class? exactClass, list arguments, bool newThread, Location? location){ 20 | parent(Node).construct(location) 21 | this.m = m 22 | this.base = base 23 | this.exactClass = exactClass 24 | this.arguments = arguments 25 | this.newThread = newThread 26 | } 27 | 28 | [public] 29 | method getType() returns Types{ 30 | return this.m.returnTypes 31 | } 32 | 33 | [public] 34 | method isConstant() returns bool{ 35 | return false 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/NonStaticPropertyAccessExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.properties 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class NonStaticPropertyAccessExpression extends Expression { 7 | 8 | [readpublic] 9 | property Property p 10 | [readpublic] 11 | property Expression base 12 | 13 | method construct(Property p, Expression base, Location? location){ 14 | parent(Node).construct(location) 15 | this.p = p 16 | this.base = base 17 | } 18 | 19 | [public] 20 | method getType() returns Types{ 21 | return this.p.types 22 | } 23 | 24 | [public] 25 | method isConstant() returns bool{ 26 | return false 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/NonStaticPropertyAssignExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.functions 3 | import aspl.parser.utils 4 | import aspl.parser.properties 5 | 6 | [public] 7 | class NonStaticPropertyAssignExpression extends Expression{ 8 | 9 | [readpublic] 10 | property Property p 11 | [readpublic] 12 | property Expression base 13 | [readpublic] 14 | property Expression value 15 | 16 | method construct(Property p, Expression base, Expression value, Location? location){ 17 | parent(Node).construct(location) 18 | this.p = p 19 | this.base = base 20 | this.value = value 21 | } 22 | 23 | [public] 24 | method getType() returns Types{ 25 | return this.p.types 26 | } 27 | 28 | [public] 29 | method isConstant() returns bool{ 30 | return false 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/OfTypeExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class OfTypeExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression expression 9 | [readpublic] 10 | property Type type 11 | 12 | [public] 13 | method construct(Expression expression, Type type, Location? location){ 14 | parent(Node).construct(location) 15 | this.expression = expression 16 | this.type = type 17 | } 18 | 19 | [public] 20 | method getType() returns Types{ 21 | return new Types([Type:fromString("boolean")]) 22 | } 23 | 24 | [public] 25 | method isConstant() returns bool{ 26 | if(!expression.getType().canCast(type)){ 27 | return true 28 | }else{ 29 | return false 30 | } 31 | } 32 | 33 | [public] 34 | method getConstantValue() returns any{ 35 | if(!expression.getType().canCast(type)){ 36 | return false 37 | } 38 | aspl.parser.utils.fatal_error("Cannot evaluate constant value of oftype expression") 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/OrExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class OrExpression extends BinaryOperator { 6 | 7 | [public] 8 | method construct(Expression left, Expression right, Location? location){ 9 | parent(BinaryOperator).construct(left, right, location) 10 | } 11 | 12 | [public] 13 | method getType() returns Types{ 14 | return this.left.getType() 15 | } 16 | 17 | [public] 18 | method getConstantValue() returns any{ 19 | return this.left.getConstantValue() || this.right.getConstantValue() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/ParentExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.classes 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class ParentExpression extends Expression { 7 | 8 | [readpublic] 9 | property Class c 10 | 11 | [public] 12 | method construct(Class c, Location? location){ 13 | parent(Node).construct(location) 14 | this.c = c 15 | } 16 | 17 | [public] 18 | method getType() returns Types{ 19 | return new Types([this.c.type]) 20 | } 21 | 22 | [public] 23 | method isConstant() returns bool{ 24 | return false 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/PropagateErrorExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class PropagateErrorExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression expression 9 | 10 | [public] 11 | method construct(Expression expression, Location? location){ 12 | parent(Node).construct(location) 13 | this.expression = expression 14 | } 15 | 16 | [public] 17 | method getType() returns Types{ 18 | return this.expression.getType() 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/ReferenceExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class ReferenceExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression expression 9 | 10 | [public] 11 | method construct(Expression expression, Location? location){ 12 | parent(Node).construct(location) 13 | this.expression = expression 14 | } 15 | 16 | [public] 17 | method getType() returns Types{ 18 | return new Types([this.expression.getType().getPointer()]) 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/StaticMethodCallExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.methods 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class StaticMethodCallExpression extends Expression{ 7 | 8 | [readpublic] 9 | property Method m 10 | [readpublic] 11 | property Type base 12 | [readpublic] 13 | property list arguments 14 | [readpublic] 15 | property bool newThread 16 | 17 | method construct(Method m, Type base, list arguments, bool newThread, Location? location){ 18 | parent(Node).construct(location) 19 | this.m = m 20 | this.base = base 21 | this.arguments = arguments 22 | this.newThread = newThread 23 | } 24 | 25 | [public] 26 | method getType() returns Types{ 27 | return this.m.returnTypes 28 | } 29 | 30 | [public] 31 | method isConstant() returns bool{ 32 | return false 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/StaticPropertyAccessExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.properties 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class StaticPropertyAccessExpression extends Expression { 7 | 8 | [readpublic] 9 | property Property p 10 | [readpublic] 11 | property Type base 12 | 13 | method construct(Property p, Type base, Location? location){ 14 | parent(Node).construct(location) 15 | this.p = p 16 | this.base = base 17 | } 18 | 19 | [public] 20 | method getType() returns Types{ 21 | return this.p.types 22 | } 23 | 24 | [public] 25 | method isConstant() returns bool{ 26 | return false 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/StaticPropertyAssignExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.functions 3 | import aspl.parser.utils 4 | import aspl.parser.properties 5 | 6 | [public] 7 | class StaticPropertyAssignExpression extends Expression{ 8 | 9 | [readpublic] 10 | property Property p 11 | [readpublic] 12 | property Type base 13 | [readpublic] 14 | property Expression value 15 | 16 | method construct(Property p, Type base, Expression value, Location? location){ 17 | parent(Node).construct(location) 18 | this.p = p 19 | this.base = base 20 | this.value = value 21 | } 22 | 23 | [public] 24 | method getType() returns Types{ 25 | return this.p.types 26 | } 27 | 28 | [public] 29 | method isConstant() returns bool{ 30 | return false 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/StringIndexExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class StringIndexExpression extends Expression { 6 | 7 | [readpublic] 8 | property Expression base 9 | [readpublic] 10 | property Expression index 11 | 12 | [public] 13 | method construct(Expression base, Expression index, Location location){ 14 | parent(Node).construct(location) 15 | this.base = base 16 | this.index = index 17 | } 18 | 19 | [public] 20 | method getType() returns Types{ 21 | return new Types([Type:fromString("string")]) 22 | } 23 | 24 | [public] 25 | method isConstant() returns bool{ 26 | return this.base.isConstant() && this.index.isConstant() 27 | } 28 | 29 | [public] 30 | method getConstantValue() returns any{ 31 | return string(this.base.getConstantValue())[int(this.index.getConstantValue())] 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/ThisExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.classes 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class ThisExpression extends Expression { 7 | 8 | [readpublic] 9 | property Class c 10 | 11 | [public] 12 | method construct(Class c, Location? location){ 13 | parent(Node).construct(location) 14 | this.c = c 15 | } 16 | 17 | [public] 18 | method getType() returns Types{ 19 | return new Types([this.c.type]) 20 | } 21 | 22 | [public] 23 | method isConstant() returns bool{ 24 | return false 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/UnaryOperator.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | [abstract] 6 | class UnaryOperator extends Expression { 7 | 8 | [readpublic] 9 | property Expression expression 10 | 11 | [public] 12 | method construct(Expression expression, Location? location){ 13 | parent(Node).construct(location) 14 | this.expression = expression 15 | } 16 | 17 | [public] 18 | method isConstant() returns bool{ 19 | return expression.isConstant() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/VariableAccessExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.functions 3 | import aspl.parser.utils 4 | import aspl.parser.variables 5 | 6 | [public] 7 | class VariableAccessExpression extends Expression{ 8 | 9 | [readpublic] 10 | property Variable variable 11 | 12 | method construct(Variable variable, Location? location){ 13 | parent(Node).construct(location) 14 | this.variable = variable 15 | } 16 | 17 | [public] 18 | method getType() returns Types{ 19 | return this.variable.types 20 | } 21 | 22 | [public] 23 | method isConstant() returns bool{ 24 | return false 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/VariableAssignExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.functions 3 | import aspl.parser.utils 4 | import aspl.parser.variables 5 | 6 | [public] 7 | class VariableAssignExpression extends Expression{ 8 | 9 | [readpublic] 10 | property Variable variable 11 | [readpublic] 12 | property Expression value 13 | 14 | method construct(Variable variable, Expression value, Location? location){ 15 | parent(Node).construct(location) 16 | this.variable = variable 17 | this.value = value 18 | } 19 | 20 | [public] 21 | method getType() returns Types{ 22 | return this.variable.types 23 | } 24 | 25 | [public] 26 | method isConstant() returns bool{ 27 | return false 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/VariableDeclareExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.functions 3 | import aspl.parser.utils 4 | import aspl.parser.variables 5 | 6 | [public] 7 | class VariableDeclareExpression extends Expression{ 8 | 9 | [readpublic] 10 | property Variable variable 11 | [readpublic] 12 | property Expression value 13 | 14 | method construct(Variable variable, Expression value, Location? location){ 15 | parent(Node).construct(location) 16 | this.variable = variable 17 | this.value = value 18 | } 19 | 20 | [public] 21 | method getType() returns Types{ 22 | return this.variable.types 23 | } 24 | 25 | [public] 26 | method isConstant() returns bool{ 27 | return false 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/expressions/XorExpression.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class XorExpression extends BinaryOperator { 6 | 7 | [public] 8 | method construct(Expression left, Expression right, Location? location){ 9 | parent(BinaryOperator).construct(left, right, location) 10 | } 11 | 12 | [public] 13 | method getType() returns Types{ 14 | return this.left.getType() 15 | } 16 | 17 | [public] 18 | method getConstantValue() returns any{ 19 | return this.left.getConstantValue()^this.right.getConstantValue() 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/BooleanLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class BooleanLiteral extends Literal{ 6 | 7 | [readpublic] 8 | property bool value 9 | 10 | method construct(bool value, Location? location){ 11 | parent(Node).construct(location) 12 | this.value = value 13 | } 14 | 15 | [public] 16 | method getType() returns Types{ 17 | return new Types([Type:fromString("boolean")]) 18 | } 19 | 20 | [public] 21 | method isConstant() returns bool{ 22 | return true 23 | } 24 | 25 | [public] 26 | method getConstantValue() returns any{ 27 | return value 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/ByteLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | class ByteLiteral extends Literal{ 5 | 6 | [readpublic] 7 | property byte value 8 | 9 | method construct(byte value, Location? location){ 10 | parent(Node).construct(location) 11 | this.value = value 12 | } 13 | 14 | [public] 15 | method getType() returns Types{ 16 | return new Types([Type:fromString("byte")]) 17 | } 18 | 19 | [public] 20 | method isConstant() returns bool{ 21 | return true 22 | } 23 | 24 | [public] 25 | method getConstantValue() returns any{ 26 | return value 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/CallbackLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | import aspl.parser.callbacks 4 | 5 | class CallbackLiteral extends Literal{ 6 | 7 | [readpublic] 8 | property Callback value 9 | [readpublic] 10 | property list capturedVariables 11 | 12 | method construct(Callback value, list capturedVariables, Location? location){ 13 | parent(Node).construct(location) 14 | this.value = value 15 | this.capturedVariables = capturedVariables 16 | } 17 | 18 | [public] 19 | method getType() returns Types{ 20 | return new Types([this.value.type]) 21 | } 22 | 23 | [public] 24 | method isConstant() returns bool{ 25 | return false 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/DoubleLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class DoubleLiteral extends Literal{ 6 | 7 | [readpublic] 8 | property double value 9 | 10 | method construct(double value, Location? location){ 11 | parent(Node).construct(location) 12 | this.value = value 13 | } 14 | 15 | [public] 16 | method getType() returns Types{ 17 | return new Types([Type:fromString("double")]) 18 | } 19 | 20 | [public] 21 | method isConstant() returns bool{ 22 | return true 23 | } 24 | 25 | [public] 26 | method getConstantValue() returns any{ 27 | return value 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/FloatLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class FloatLiteral extends Literal{ 6 | 7 | [readpublic] 8 | property float value 9 | 10 | method construct(float value, Location? location){ 11 | parent(Node).construct(location) 12 | this.value = value 13 | } 14 | 15 | [public] 16 | method getType() returns Types{ 17 | return new Types([Type:fromString("float")]) 18 | } 19 | 20 | [public] 21 | method isConstant() returns bool{ 22 | return true 23 | } 24 | 25 | [public] 26 | method getConstantValue() returns any{ 27 | return value 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/IntegerLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class IntegerLiteral extends Literal{ 6 | 7 | [readpublic] 8 | property int value 9 | 10 | method construct(int value, Location? location){ 11 | parent(Node).construct(location) 12 | this.value = value 13 | } 14 | 15 | [public] 16 | method getType() returns Types{ 17 | return new Types([Type:fromString("integer")]) 18 | } 19 | 20 | [public] 21 | method isConstant() returns bool{ 22 | return true 23 | } 24 | 25 | [public] 26 | method getConstantValue() returns any{ 27 | return value 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/ListLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | import aspl.parser.ast.expressions 4 | 5 | [public] 6 | class ListLiteral extends Literal{ 7 | 8 | [public] 9 | property Types type 10 | [public] 11 | property list value 12 | 13 | method construct(Types type, list value, Location? location){ 14 | parent(Node).construct(location) 15 | this.type = type 16 | this.value = value 17 | } 18 | 19 | [public] 20 | method getType() returns Types{ 21 | return new Types([Type:fromString("list<" + this.type.toString() + ">")]) 22 | } 23 | 24 | [public] 25 | method isConstant() returns bool{ 26 | foreach(this.value as element){ 27 | if(!element.isConstant()){ 28 | return false 29 | } 30 | } 31 | return true 32 | } 33 | 34 | [public] 35 | method getConstantValue() returns any{ 36 | var list l = list[] 37 | foreach(this.value as element){ 38 | l.add(element.getConstantValue()) 39 | } 40 | return l 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/Literal.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast.expressions 2 | 3 | [public] 4 | [abstract] 5 | class Literal extends Expression{ 6 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/LongLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class LongLiteral extends Literal{ 6 | 7 | [readpublic] 8 | property long value 9 | 10 | method construct(long value, Location? location){ 11 | parent(Node).construct(location) 12 | this.value = value 13 | } 14 | 15 | [public] 16 | method getType() returns Types{ 17 | return new Types([Type:fromString("long")]) 18 | } 19 | 20 | [public] 21 | method isConstant() returns bool{ 22 | return true 23 | } 24 | 25 | [public] 26 | method getConstantValue() returns any{ 27 | return value 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/MapLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class MapLiteral extends Literal{ 6 | 7 | [readpublic] 8 | property Types keyType 9 | [readpublic] 10 | property Types valueType 11 | [readpublic] 12 | property list value 13 | 14 | method construct(Types keyType, Types valueType, list value, Location? location){ 15 | parent(Node).construct(location) 16 | this.keyType = keyType 17 | this.valueType = valueType 18 | this.value = value 19 | } 20 | 21 | [public] 22 | method getType() returns Types{ 23 | return new Types([Type:fromString("map<" + this.keyType.toString() + ", " + this.valueType.toString() + ">")]) 24 | } 25 | 26 | [public] 27 | method isConstant() returns bool{ 28 | foreach(this.value as pair){ 29 | if(!pair.k.isConstant()){ 30 | return false 31 | } 32 | if(!pair.v.isConstant()){ 33 | return false 34 | } 35 | } 36 | return true 37 | } 38 | 39 | [public] 40 | method getConstantValue() returns any{ 41 | var map m = map{} 42 | foreach(this.value as pair){ 43 | m[pair.k.getConstantValue()] = pair.v.getConstantValue() 44 | } 45 | return m 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/NullLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class NullLiteral extends Literal{ 6 | 7 | method construct(Location? location){ 8 | parent(Node).construct(location) 9 | } 10 | 11 | [public] 12 | method getType() returns Types{ 13 | return new Types([Type:fromString("null")]) 14 | } 15 | 16 | [public] 17 | method isConstant() returns bool{ 18 | return true 19 | } 20 | 21 | [public] 22 | method getConstantValue() returns any{ 23 | return null 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/literals/StringLiteral.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class StringLiteral extends Literal{ 6 | 7 | [readpublic] 8 | property string value 9 | [readpublic] 10 | property string literalString 11 | 12 | method construct(string value, string literalString, Location? location){ 13 | parent(Node).construct(location) 14 | this.value = value 15 | this.literalString = literalString 16 | } 17 | 18 | [public] 19 | method getType() returns Types{ 20 | return new Types([Type:fromString("string")]) 21 | } 22 | 23 | [public] 24 | method isConstant() returns bool{ 25 | return true 26 | } 27 | 28 | [public] 29 | method getConstantValue() returns any{ 30 | return value 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/AssertStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class AssertStatement extends Statement{ 7 | 8 | [readpublic] 9 | property Expression expression 10 | 11 | method construct(Expression expression, Location? location){ 12 | parent(Node).construct(location) 13 | this.expression = expression 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/BlockStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class BlockStatement extends Statement{ 7 | 8 | [readpublic] 9 | property list statements 10 | 11 | [readpublic] 12 | property bool isCompileTime 13 | 14 | method construct(list statements, bool isCompileTime, Location? location){ 15 | parent(Node).construct(location) 16 | this.statements = statements 17 | this.isCompileTime = isCompileTime 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/BreakStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class BreakStatement extends Statement{ 7 | 8 | [readpublic] 9 | property int level 10 | 11 | method construct(int level, Location? location){ 12 | parent(Node).construct(location) 13 | this.level = level 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/ClassDeclareStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.classes 3 | import aspl.parser.utils 4 | import aspl.parser.lexer 5 | 6 | [public] 7 | class ClassDeclareStatement extends Statement{ 8 | 9 | [readpublic] 10 | property Class c 11 | [readpublic] 12 | property list comments 13 | 14 | method construct(Class c, list comments, Location? location){ 15 | parent(Node).construct(location) 16 | this.c = c 17 | this.comments = comments 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/ContinueStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class ContinueStatement extends Statement{ 7 | 8 | [readpublic] 9 | property int level 10 | 11 | method construct(int level, Location? location){ 12 | parent(Node).construct(location) 13 | this.level = level 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/EnumDeclareStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.enums 3 | import aspl.parser.utils 4 | import aspl.parser.lexer 5 | 6 | [public] 7 | class EnumDeclareStatement extends Statement{ 8 | 9 | [readpublic] 10 | property Enum e 11 | [readpublic] 12 | property list comments 13 | 14 | method construct(Enum e, list comments, Location? location){ 15 | parent(Node).construct(location) 16 | this.e = e 17 | this.comments = comments 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/EscapeStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class EscapeStatement extends Statement{ 7 | 8 | [readpublic] 9 | property Expression? value 10 | 11 | method construct(Expression? value, Location? location){ 12 | parent(Node).construct(location) 13 | this.value = value 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/FallbackStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class FallbackStatement extends Statement{ 7 | 8 | [readpublic] 9 | property Expression value 10 | 11 | method construct(Expression value, Location? location){ 12 | parent(Node).construct(location) 13 | this.value = value 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/ForeachStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class ForeachStatement extends Statement { 7 | 8 | [readpublic] 9 | property Expression collection 10 | [readpublic] 11 | property string? key 12 | [readpublic] 13 | property string? value 14 | [readpublic] 15 | property list code 16 | 17 | [public] 18 | method construct(Expression collection, string? key, string? value, list code, Location? location){ 19 | parent(Node).construct(location) 20 | this.collection = collection 21 | this.key = key 22 | this.value = value 23 | this.code = code 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/FunctionDeclareStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.functions 3 | import aspl.parser.utils 4 | import aspl.parser.lexer 5 | 6 | [public] 7 | class FunctionDeclareStatement extends Statement{ 8 | 9 | [readpublic] 10 | property Function func 11 | [readpublic] 12 | property list comments 13 | 14 | method construct(Function func, list comments, Location? location){ 15 | parent(Node).construct(location) 16 | this.func = func 17 | this.comments = comments 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/IfElseIfStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class IfElseIfStatement extends Statement { 7 | 8 | [readpublic] 9 | property Expression condition 10 | [readpublic] 11 | property list ifCode 12 | [readpublic] 13 | property IfStatement|IfElseIfStatement|IfElseStatement elseIf 14 | 15 | [public] 16 | method construct(Expression condition, list ifCode, IfStatement|IfElseIfStatement|IfElseStatement elseIf, Location? location){ 17 | parent(Node).construct(location) 18 | this.condition = condition 19 | this.ifCode = ifCode 20 | this.elseIf = elseIf 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/IfElseStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class IfElseStatement extends Statement { 7 | 8 | [readpublic] 9 | property Expression condition 10 | [readpublic] 11 | property list ifCode 12 | [readpublic] 13 | property list elseCode 14 | 15 | [public] 16 | method construct(Expression condition, list ifCode, list elseCode, Location? location){ 17 | parent(Node).construct(location) 18 | this.condition = condition 19 | this.ifCode = ifCode 20 | this.elseCode = elseCode 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/IfStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class IfStatement extends Statement { 7 | 8 | [readpublic] 9 | property Expression condition 10 | [readpublic] 11 | property list code 12 | 13 | [public] 14 | method construct(Expression condition, list code, Location? location){ 15 | parent(Node).construct(location) 16 | this.condition = condition 17 | this.code = code 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/IncludeFileStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class IncludeFileStatement extends Statement{ 6 | 7 | [readpublic] 8 | property string file 9 | 10 | method construct(string file, Location? location){ 11 | parent(Node).construct(location) 12 | this.file = file 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/LinkLibraryStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class LinkLibraryStatement extends Statement{ 6 | 7 | [readpublic] 8 | property string library 9 | 10 | method construct(string library, Location? location){ 11 | parent(Node).construct(location) 12 | this.library = library 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/MethodDeclareStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.methods 3 | import aspl.parser.utils 4 | import aspl.parser.lexer 5 | 6 | [public] 7 | class MethodDeclareStatement extends Statement{ 8 | 9 | [readpublic] 10 | property Method m 11 | [readpublic] 12 | property list comments 13 | 14 | method construct(Method m, list comments, Location? location){ 15 | parent(Node).construct(location) 16 | this.m = m 17 | this.comments = comments 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/NopStatement.aspl: -------------------------------------------------------------------------------- 1 | // This class represents a no operation instruction 2 | // It should be automatically filtered out by the parser before being passed to e.g. the compiler 3 | [public] 4 | class NopStatement extends Statement { 5 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/PropertyDeclareStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.properties 3 | import aspl.parser.utils 4 | import aspl.parser.lexer 5 | 6 | [public] 7 | class PropertyDeclareStatement extends Statement{ 8 | 9 | [readpublic] 10 | property Property p 11 | [readpublic] 12 | property list comments 13 | 14 | method construct(Property p, list comments, Location? location){ 15 | parent(Node).construct(location) 16 | this.p = p 17 | this.comments = comments 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/RepeatStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class RepeatStatement extends Statement { 7 | 8 | [readpublic] 9 | property Expression iterations 10 | [readpublic] 11 | property string? variable 12 | [readpublic] 13 | property int start 14 | [readpublic] 15 | property list code 16 | 17 | [public] 18 | method construct(Expression iterations, string? variable, int start, list code, Location? location){ 19 | parent(Node).construct(location) 20 | this.iterations = iterations 21 | this.variable = variable 22 | this.start = start 23 | this.code = code 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/ReturnStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | import aspl.parser.functions 5 | import aspl.parser.methods 6 | import aspl.parser.properties 7 | import aspl.parser.callbacks 8 | 9 | [public] 10 | class ReturnStatement extends Statement{ 11 | 12 | [readpublic] 13 | property Expression? value 14 | [readpublic] 15 | property Function|Method|Callback|ReactivePropertyCallback callable 16 | 17 | method construct(Expression? value, Function|Method|Callback|ReactivePropertyCallback callable, Location? location){ 18 | parent(Node).construct(location) 19 | this.value = value 20 | this.callable = callable 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/Statement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | 3 | // This class is only for nodes that can never be expressions 4 | [public] 5 | [abstract] 6 | class Statement extends Node{ 7 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/ThrowStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class ThrowStatement extends Statement{ 7 | 8 | [readpublic] 9 | property ClassInstantiateExpression errorInstance 10 | 11 | method construct(ClassInstantiateExpression errorInstance, Location? location){ 12 | parent(Node).construct(location) 13 | this.errorInstance = errorInstance 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/ast/statements/WhileStatement.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.utils 4 | 5 | [public] 6 | class WhileStatement extends Statement { 7 | 8 | [readpublic] 9 | property Expression condition 10 | [readpublic] 11 | property list code 12 | 13 | [public] 14 | method construct(Expression condition, list code, Location? location){ 15 | parent(Node).construct(location) 16 | this.condition = condition 17 | this.code = code 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/attributes/AttributeInstance.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.utils 2 | import aspl.parser.ast.expressions 3 | import aspl.parser.lexer 4 | 5 | [public] 6 | class AttributeInstance { 7 | 8 | [readpublic] 9 | property Attribute attribute 10 | [readpublic] 11 | property list arguments 12 | [readpublic] 13 | property Location? location 14 | [readpublic] 15 | property list comments 16 | 17 | [public] 18 | method construct(Attribute attribute, list arguments, Location? location, list comments){ 19 | this.attribute = attribute 20 | this.arguments = arguments 21 | this.location = location 22 | this.comments = comments 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/attributes/AttributeUsage.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | [flags] 3 | enum AttributeUsage { 4 | Function, 5 | Callback, 6 | Class, 7 | Property, 8 | Method, 9 | Enum, 10 | EnumField 11 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/callbacks/Callback.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.utils 2 | import aspl.parser.variables 3 | import aspl.parser.ast 4 | 5 | [public] 6 | class Callback { 7 | 8 | [readpublic] 9 | property Type type 10 | [readpublic] 11 | property list parameters 12 | [readpublic] 13 | property Types returnTypes 14 | [public] 15 | property list? code 16 | [readpublic] 17 | property ScopeBundle creationScope 18 | [readpublic] 19 | property Location location 20 | 21 | [public] 22 | method construct(Type type, list parameters, Types returnTypes, list? code, ScopeBundle creationScope, Location location){ 23 | this.type = type 24 | this.parameters = parameters 25 | this.returnTypes = returnTypes 26 | this.code = code 27 | this.creationScope = creationScope 28 | this.location = location 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/enums/EnumField.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.utils 2 | import aspl.parser.attributes 3 | 4 | [public] 5 | class EnumField{ 6 | 7 | [readpublic] 8 | property Enum e 9 | [readpublic] 10 | property string name 11 | [readpublic] 12 | property int? value 13 | [readpublic] 14 | property list attributes 15 | [readpublic] 16 | property Location location 17 | 18 | [public] 19 | method construct(Enum e, string name, int? value, list attributes, Location location){ 20 | this.e = e 21 | this.name = name 22 | this.attributes = attributes 23 | this.value = value 24 | this.location = location 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/functions/CustomFunction.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser 2 | import aspl.parser.utils 3 | import aspl.parser.ast 4 | import aspl.parser.attributes 5 | 6 | [public] 7 | class CustomFunction extends Function{ 8 | 9 | [public] 10 | property list? code 11 | [readpublic] 12 | property Module module 13 | [readpublic] 14 | property Location? location 15 | [readpublic] 16 | property Location? headerEndLocation 17 | 18 | [public] 19 | method construct(string identifier, list parameters, Types returnTypes, list attributes, list? code, Module module, Location? location, Location? headerEndLocation){ 20 | parent(Function).construct(identifier, parameters, returnTypes, attributes) 21 | this.fullyInitialized = code != null 22 | this.code = code 23 | this.module = module 24 | this.location = location 25 | this.headerEndLocation = headerEndLocation 26 | 27 | foreach(attributes as attribute){ 28 | // Caching these for performance reasons 29 | if(attribute.attribute.identifier == "public"){ 30 | isPublic = true 31 | }elseif(attribute.attribute.identifier == "throws"){ 32 | canThrow = true 33 | } 34 | } 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/functions/InternalFunction.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.utils 2 | import aspl.parser.attributes 3 | 4 | [public] 5 | class InternalFunction extends Function{ 6 | 7 | [public] 8 | method construct(string identifier, list parameters, Types returnTypes, list attributes){ 9 | parent(Function).construct(identifier, parameters, returnTypes, attributes) 10 | this.isPublic = true 11 | this.fullyInitialized = false 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/lexer/RegexTokenPattern.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class RegexTokenPattern extends TokenPattern{ 3 | 4 | method construct(string pattern){ // TODO: This overwrite shouldn't be required 5 | this.pattern = pattern 6 | } 7 | 8 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/lexer/RegularTokenPattern.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class RegularTokenPattern extends TokenPattern{ 3 | 4 | method construct(string pattern){ // TODO: This overwrite shouldn't be required 5 | this.pattern = pattern 6 | } 7 | 8 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/lexer/StringToken.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.utils 2 | 3 | [public] 4 | class StringToken extends Token { 5 | 6 | [readpublic] 7 | property string literalString 8 | 9 | method construct(TokenType type, string value, string literalString, Location location){ 10 | parent(Token).construct(type, value, location) 11 | this.literalString = literalString 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/lexer/TokenPattern.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | [abstract] 3 | class TokenPattern{ 4 | 5 | [readpublic] 6 | property string pattern 7 | 8 | method construct(string pattern){ 9 | this.pattern = pattern 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/lexer/TokenType.aspl: -------------------------------------------------------------------------------- 1 | enum TokenType{ 2 | CommentSingleline, 3 | CommentMultiline, 4 | Identifier, 5 | Byte, 6 | Integer, 7 | Long, 8 | Float, 9 | Double, 10 | String, 11 | ParenthesisOpen, 12 | ParenthesisClose, 13 | BracketOpen, 14 | BracketClose, 15 | BraceOpen, 16 | BraceClose, 17 | Comma, 18 | Dot, 19 | Colon, 20 | Assign, 21 | Plus, 22 | PlusPlus, 23 | PlusEquals, 24 | Minus, 25 | MinusMinus, 26 | MinusEquals, 27 | Asterisk, 28 | MultiplyEquals, 29 | Slash, 30 | DivideEquals, 31 | Modulo, 32 | ModuloEquals, 33 | Equals, 34 | CheckEquals, 35 | CheckNotEquals, 36 | And, 37 | Or, 38 | Xor, 39 | Negate, 40 | LessThan, 41 | LessThanOrEqual, 42 | GreaterThan, 43 | GreaterThanOrEqual, 44 | Ampersand, 45 | Pipe, 46 | Dollar, 47 | QuestionMark, 48 | QuestionAndExclamationMark 49 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/methods/InternalMethod.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.utils 2 | import aspl.parser.attributes 3 | 4 | [public] 5 | class InternalMethod extends Method{ 6 | 7 | [public] 8 | method construct(Type type, string name, list parameters, Types returnTypes, list attributes){ 9 | parent(Method).construct(type, name, parameters, returnTypes, attributes) 10 | this.isAbstract = false 11 | this.isStatic = false 12 | this.isPublic = true 13 | this.canThrow = false 14 | this.fullyInitialized = false 15 | } 16 | 17 | [public] 18 | method withType(Type type) returns Method{ 19 | return new self(type, this.name, this.parameters, this.returnTypes, this.attributes) 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/precedence/PrecedenceLevel.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | enum PrecedenceLevel { 3 | None = -1, 4 | And = 0, 5 | Or = 0, 6 | Xor = 0, 7 | OfType = 1, 8 | CheckEquals = 1, 9 | CheckNotEquals = 1, 10 | PlusEquals = 1, 11 | MinusEquals = 1, 12 | MultiplyEquals = 1, 13 | DivideEquals = 1, 14 | ModuloEquals = 1, 15 | LessThan = 1, 16 | LessThanOrEqual = 1, 17 | GreaterThan = 1, 18 | GreaterThanOrEqual = 1, 19 | Plus = 2, 20 | Minus = 2, 21 | Asterisk = 3, 22 | Slash = 3, 23 | Modulo = 3, 24 | Negate = 3, 25 | Reference = 3, 26 | PlusPlus = 4, 27 | MinusMinus = 4, 28 | Dot = 4, 29 | QuestionAndExclamationMark = 4, 30 | BracketOpen = 5, 31 | Catch = 5, // TODO: Is the precedence level correct? 32 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/properties/InternalProperty.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.utils 2 | import aspl.parser.attributes 3 | 4 | [public] 5 | class InternalProperty extends Property{ 6 | 7 | [public] 8 | method construct(Type type, string name, Types types, list attributes){ 9 | parent(Property).construct(type, name, types, attributes) 10 | this.isStatic = false 11 | this.isPublic = false 12 | this.isReadPublic = true 13 | this.fullyInitialized = false 14 | } 15 | 16 | [public] 17 | method withType(Type type) returns Property{ 18 | return new self(type, this.name, this.types, this.attributes) 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/properties/ReactivePropertyCallback.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.utils 2 | import aspl.parser.properties 3 | 4 | [public] 5 | class ReactivePropertyCallback { 6 | 7 | [readpublic] 8 | property Property p 9 | [readpublic] 10 | property Types returnTypes 11 | 12 | [public] 13 | method construct(Property p, Types returnTypes) { 14 | this.p = p 15 | this.returnTypes = returnTypes 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/GenericsUtils.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser 2 | 3 | [public] 4 | [static] 5 | class GenericsUtils { 6 | 7 | // type.identifier => ["T", "U", ...] 8 | [public] 9 | [static] 10 | property map> typePlaceholders = {} 11 | // function.identifier => ["T", "U", ...] 12 | [public] 13 | [static] 14 | property map> functionPlaceholders = {} 15 | 16 | [public] 17 | [static] 18 | method init(){ 19 | self:typePlaceholders[Type:fromString("list").toString()] = ["T"] 20 | self:typePlaceholders[Type:fromString("map").toString()] = ["T", "U"] 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/IdentifierResult.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class IdentifierResult { 3 | 4 | [readpublic] 5 | property string identifier 6 | [readpublic] 7 | property int tokenCount 8 | [readpublic] 9 | property Location? location 10 | 11 | [public] 12 | method construct(string identifier, int tokenCount, Location? location) { 13 | this.identifier = identifier 14 | this.tokenCount = tokenCount 15 | this.location = location 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/ImplementationCallUtils.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | [static] 3 | class ImplementationCallUtils { 4 | 5 | [public] 6 | [static] 7 | [threadlocal] 8 | property map usedImplementationCalls // map of implementation call names to number of arguments 9 | 10 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/ImportTable.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser 2 | 3 | [public] 4 | class ImportTable { 5 | 6 | property list namespaces = [] 7 | 8 | [public] 9 | method importNamespace(string namespace){ 10 | namespaces.add(namespace) 11 | } 12 | 13 | [public] 14 | method canResolveAbbreviation(Parser parser, string abbreviation) returns bool{ 15 | foreach(namespaces as namespace){ 16 | if(Type:existsByName(null, namespace + "." + abbreviation)){ 17 | return true 18 | } 19 | } 20 | return false 21 | } 22 | 23 | [public] 24 | method resolveAbbreviation(Parser parser, string abbreviation) returns Type{ 25 | foreach(namespaces as namespace){ 26 | if(Type:existsByName(null, namespace + "." + abbreviation)){ 27 | return Type:fromString(namespace + "." + abbreviation) 28 | } 29 | } 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/Location.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class Location{ 3 | 4 | [readpublic] 5 | property string file 6 | [readpublic] 7 | property int startLine 8 | [readpublic] 9 | property int endLine 10 | [readpublic] 11 | property int startColumn 12 | [readpublic] 13 | property int endColumn 14 | 15 | method construct(string file, int startLine, int endLine, int startColumn, int endColumn){ 16 | this.file = file 17 | this.startLine = startLine 18 | this.endLine = endLine 19 | this.startColumn = startColumn 20 | this.endColumn = endColumn 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/ModuleUtils.aspl: -------------------------------------------------------------------------------- 1 | import io 2 | import aspl.parser 3 | 4 | [public] 5 | [static] 6 | class ModuleUtils { 7 | 8 | [public] 9 | [static] 10 | method getModulePath(string module) returns string{ 11 | if(Module:mainModule != null && module.toLower() == Module:mainModule.name.toLower()){ 12 | return Module:mainModule.directory 13 | } 14 | // TODO: Make the below case insensitive 15 | if(io.exists_directory(io.abs(io.join_path([io.full_directory_path(io.get_executable_path()), "stdlib", module])))){ 16 | return io.abs(io.join_path([io.full_directory_path(io.get_executable_path()), "stdlib", module])) 17 | } 18 | return io.abs(io.join_path([io.get_home_directory(), ".aspl_modules", module])) 19 | } 20 | 21 | [public] 22 | [static] 23 | method isFilePartOfStdlib(string file) returns boolean{ 24 | return file.startsWith(io.abs(io.join_path([io.full_directory_path(io.get_executable_path()), "stdlib"]))) // TODO: This might fail with some weird paths? 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/Pair.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast.expressions 2 | 3 | [public] 4 | class Pair { 5 | 6 | [readpublic] 7 | property Expression k 8 | [readpublic] 9 | property Expression v 10 | 11 | [public] 12 | method construct(Expression k, Expression v) { 13 | this.k = k 14 | this.v = v 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/Parameter.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast.expressions 2 | import aspl.parser.utils 3 | 4 | [public] 5 | class Parameter { 6 | 7 | [readpublic] 8 | property string name 9 | [readpublic] 10 | property Types types 11 | [readpublic] 12 | property Expression? defaultValue 13 | [public] 14 | property bool optional{ 15 | get{ 16 | return defaultValue != null 17 | } 18 | } 19 | [readpublic] 20 | property Location? location 21 | 22 | [public] 23 | method construct(string name, Types types, Expression? defaultValue = null, Location? location = null) { 24 | this.name = name 25 | this.types = types 26 | this.defaultValue = defaultValue 27 | this.location = location 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/ParseMode.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | enum ParseMode { 3 | 4 | Normal, 5 | Preprocess, 6 | PreprocessTypes, 7 | Import 8 | 9 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/ReturnTypeUtils.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.functions 2 | import aspl.parser.methods 3 | import aspl.parser.properties 4 | import aspl.parser.callbacks 5 | 6 | [public] 7 | [static] 8 | class ReturnTypeUtils{ 9 | 10 | [public] 11 | [static] 12 | method getReturnTypes(Function|Method|Callback|ReactivePropertyCallback? func) returns Types{ 13 | var returnTypes = new Types([]) 14 | if(func oftype Function){ 15 | returnTypes = Function(func).returnTypes 16 | }elseif(func oftype Method){ 17 | returnTypes = Method(func).returnTypes 18 | }elseif(func oftype Callback){ 19 | returnTypes = Callback(func).returnTypes 20 | }elseif(func oftype ReactivePropertyCallback){ 21 | returnTypes = ReactivePropertyCallback(func).returnTypes 22 | } 23 | return returnTypes 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/TokenList.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.lexer 2 | 3 | [public] 4 | class TokenList{ 5 | 6 | property list* tokens 7 | [readpublic] 8 | property int position 9 | 10 | [public] 11 | property int length{ 12 | get{ 13 | return (*tokens).length - position 14 | } 15 | } 16 | 17 | method construct(list tokens){ 18 | this.tokens = &tokens 19 | } 20 | 21 | [public] 22 | method peek(int offset = 0) returns Token{ 23 | return (*tokens)[offset + position] 24 | } 25 | 26 | [public] 27 | method shift(int amount = 1){ 28 | position += amount 29 | } 30 | 31 | [public] 32 | method next(int offset = 0) returns Token{ 33 | var token = (*tokens)[offset + position] 34 | shift(offset + 1) 35 | return token 36 | } 37 | 38 | [public] 39 | method empty() returns bool{ 40 | return length == 0 41 | } 42 | 43 | [public] 44 | method in(int offset) returns TokenList{ 45 | var newTokens = new TokenList((*tokens).cloneShallow()) 46 | newTokens.shift(position + offset) 47 | return newTokens 48 | } 49 | 50 | [public] 51 | method clone() returns TokenList{ 52 | return new TokenList((*tokens).cloneShallow()) 53 | } 54 | 55 | [public] 56 | method set(TokenList other){ 57 | tokens = other.tokens 58 | position = other.position 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/utils/expressions.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.ast 2 | import aspl.parser.ast.statements 3 | import aspl.parser.ast.expressions 4 | 5 | [public] 6 | function verify_expression(Node node) returns Expression{ 7 | if(!(node oftype Expression)){ 8 | if(node oftype Statement){ 9 | generic_error("Expected expression, but got statement", node.location) 10 | }else{ 11 | generic_error("Expected expression", node.location) 12 | } 13 | } 14 | return Expression(node) 15 | } -------------------------------------------------------------------------------- /stdlib/aspl/parser/variables/ScopeBundle.aspl: -------------------------------------------------------------------------------- 1 | import aspl.parser.functions 2 | import aspl.parser.methods 3 | import aspl.parser.properties 4 | import aspl.parser.callbacks 5 | 6 | [public] 7 | class ScopeBundle { 8 | 9 | [readpublic] 10 | property list scopes = [] 11 | [public] 12 | property Function|Method|Callback|ReactivePropertyCallback? func 13 | 14 | [public] 15 | method construct(Function|Method|Callback|ReactivePropertyCallback? func){ 16 | this.func = func 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /stdlib/bitconverter/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/breakpoints/breakpoints.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function break(string? message = null){ 3 | implement("breakpoints.break", message) 4 | } -------------------------------------------------------------------------------- /stdlib/breakpoints/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if ailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/chars/chars.aspl: -------------------------------------------------------------------------------- 1 | import encoding.utf8 2 | import bitconverter 3 | 4 | [public] 5 | function int_to_char(int codepoint) returns string{ 6 | return string(implement("chars.int_to_char", codepoint)) 7 | } -------------------------------------------------------------------------------- /stdlib/chars/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/chars/implementations/implementations.c: -------------------------------------------------------------------------------- 1 | ASPL_OBJECT_TYPE ASPL_IMPLEMENT_chars$int_to_char(ASPL_OBJECT_TYPE* integer){ 2 | ASPL_OBJECT_TYPE integerObj = (ASPL_OBJECT_TYPE)*integer; 3 | char *string = ASPL_MALLOC(2); 4 | string[0] = ASPL_ACCESS(integerObj).value.integer8; 5 | string[1] = '\0'; 6 | return ASPL_STRING_LITERAL(string); 7 | } -------------------------------------------------------------------------------- /stdlib/encoding/ascii/decoder.aspl: -------------------------------------------------------------------------------- 1 | import encoding.utf8 2 | 3 | [public] 4 | function decode(list bytes) returns string{ 5 | var s = "" 6 | foreach(bytes as b){ 7 | s += decode_char(b) 8 | } 9 | return s 10 | } 11 | 12 | [public] 13 | function decode_char(byte b) returns string{ 14 | return encoding.utf8.decode([b]) 15 | } -------------------------------------------------------------------------------- /stdlib/encoding/ascii/encoder.aspl: -------------------------------------------------------------------------------- 1 | import encoding.utf8 2 | 3 | [public] 4 | function encode(string s) returns list{ 5 | var list bytes = [] 6 | foreach(s as c){ 7 | bytes.add(encode_char(c)) 8 | } 9 | return bytes 10 | } 11 | 12 | [public] 13 | function encode_char(string c) returns byte{ 14 | return encoding.utf8.encode(c)[0] 15 | } -------------------------------------------------------------------------------- /stdlib/encoding/base64/base64.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function encode(string s) returns string{ 3 | return string(implement("encoding.base64.encode", s)) 4 | } 5 | 6 | [public] 7 | function decode(string s) returns string{ 8 | return string(implement("encoding.base64.decode", s)) 9 | } -------------------------------------------------------------------------------- /stdlib/encoding/base64/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/encoding/utf8/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/encoding/utf8/utf8.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function encode(string s) returns list{ 3 | return list(implement("encoding.utf8.encode", s)) 4 | } 5 | 6 | [public] 7 | function encode_char(string c) returns int{ 8 | return int(implement("encoding.utf8.encode_char_to_int", c)) 9 | } 10 | 11 | [public] 12 | function decode(list bytes) returns string{ 13 | return string(implement("encoding.utf8.decode", bytes)) 14 | } 15 | 16 | [public] 17 | function decode_char(int code) returns string{ 18 | return string(implement("encoding.utf8.decode_int_to_char", code)) 19 | } -------------------------------------------------------------------------------- /stdlib/graphics/Color.aspl: -------------------------------------------------------------------------------- 1 | import rand 2 | 3 | [public] 4 | class Color{ 5 | 6 | [readpublic] 7 | property byte r 8 | [readpublic] 9 | property byte g 10 | [readpublic] 11 | property byte b 12 | [readpublic] 13 | property byte a 14 | 15 | [public] 16 | [deprecated("Use fromARGB instead")] 17 | method construct(byte a, byte r, byte g, byte b){ 18 | this.r = r 19 | this.g = g 20 | this.b = b 21 | this.a = a 22 | } 23 | 24 | [public] 25 | [static] 26 | method fromRGBA(byte r, byte g, byte b, byte a) returns self{ 27 | return new self(a, r, g, b) 28 | } 29 | 30 | [public] 31 | [static] 32 | method fromRGB(byte r, byte g, byte b) returns self{ 33 | return self:fromRGBA(r, g, b, 255) 34 | } 35 | 36 | [public] 37 | [static] 38 | method fromARGB(byte a, byte r, byte g, byte b) returns self{ 39 | return self:fromRGBA(r, g, b, a) 40 | } 41 | 42 | [public] 43 | method toString() returns string{ 44 | return "graphics.Color(r: " + string(r) + ", g: " + string(g) + ", b: " + string(b) + ", a: " + string(a) + ")" 45 | } 46 | 47 | [public] 48 | [static] 49 | method random() returns Color{ 50 | return self:fromRGB(rand.byte(), rand.byte(), rand.byte()) 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /stdlib/graphics/HorizontalAlignment.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | enum HorizontalAlignment { 3 | Left, 4 | Center, 5 | Right 6 | } -------------------------------------------------------------------------------- /stdlib/graphics/MouseButton.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | enum MouseButton { 3 | Left = 0, 4 | Right = 1, 5 | Middle = 2, 6 | Invalid = 256 7 | } -------------------------------------------------------------------------------- /stdlib/graphics/TouchPoint.aspl: -------------------------------------------------------------------------------- 1 | import math.geometry 2 | 3 | [public] 4 | class TouchPoint { 5 | 6 | [readpublic] 7 | property long identifier 8 | [readpublic] 9 | property Point position 10 | [readpublic] 11 | property TouchToolType toolType 12 | [readpublic] 13 | property bool changed 14 | 15 | [public] 16 | method construct(long identifier, Point position, TouchToolType toolType, bool changed){ 17 | this.identifier = identifier 18 | this.position = position 19 | this.toolType = toolType 20 | this.changed = changed 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /stdlib/graphics/TouchToolType.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | enum TouchToolType{ 3 | Unknown, 4 | Finger, 5 | Stylus, 6 | Mouse, 7 | Eraser, 8 | Palm 9 | } -------------------------------------------------------------------------------- /stdlib/graphics/VerticalAlignment.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | enum VerticalAlignment { 3 | Top, 4 | Center, 5 | Bottom 6 | } -------------------------------------------------------------------------------- /stdlib/graphics/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | $if windows{ 4 | $link("gdi32") 5 | } 6 | $if !ssl{ 7 | $if linux{ 8 | $link("X11") 9 | $link("Xcursor") 10 | $link("Xi") 11 | $link("GL") 12 | $link("dl") 13 | } 14 | $if macos{ 15 | $link("framework:Cocoa") 16 | $link("framework:OpenGL") 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /stdlib/graphics/text.aspl: -------------------------------------------------------------------------------- 1 | import math.geometry 2 | 3 | [public] 4 | function measure_text_size(string text, Font font) returns Size{ 5 | var size = list(implement("graphics.canvas.measure_text_size", text, font.path, font.size)) 6 | return new Size(float(size[0]), float(size[1])) 7 | } -------------------------------------------------------------------------------- /stdlib/gui/README.md: -------------------------------------------------------------------------------- 1 | # gui module 2 | This module implements a simple GUI toolkit based on the `graphics` module. 3 | 4 | It is currently very minimal, experimental and subject to change. 5 | 6 | If you are looking for an image processing or window management library, check out the `graphics` module instead. -------------------------------------------------------------------------------- /stdlib/internet/AddressFamily.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | enum AddressFamily { 3 | Unix, 4 | Ip4, 5 | Ip6, 6 | Unspecified 7 | } -------------------------------------------------------------------------------- /stdlib/internet/HttpResponse.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class HttpResponse { 3 | 4 | [readpublic] 5 | property string text 6 | [readpublic] 7 | property map> headers 8 | [readpublic] 9 | property int statusCode 10 | [readpublic] 11 | property string statusMessage 12 | [readpublic] 13 | property string httpVersion 14 | 15 | [public] 16 | method construct(string text, map> headers, int statusCode, string statusMessage, string httpVersion) { 17 | this.text = text 18 | this.headers = headers 19 | this.statusCode = statusCode 20 | this.statusMessage = statusMessage 21 | this.httpVersion = httpVersion 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /stdlib/internet/WebSocketServerClient.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class WebSocketServerClient { 3 | 4 | property any handle 5 | [readpublic] 6 | property string id 7 | 8 | [public] 9 | method construct(any handle){ 10 | this.handle = handle 11 | id = string(implement("internet.web_socket_server_client.get_id", handle)) 12 | } 13 | 14 | [public] 15 | method send(string content){ 16 | implement("internet.web_socket_server_client.send", handle, content) 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /stdlib/internet/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | $if windows{ 4 | $link("ws2_32") 5 | } 6 | } -------------------------------------------------------------------------------- /stdlib/io/BinaryStream.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class BinaryStream extends Stream{ 3 | 4 | property list bytes 5 | 6 | [public] 7 | method construct(list bytes){ 8 | this.bytes = bytes 9 | } 10 | 11 | [public] 12 | method getBytes() returns list{ 13 | return bytes 14 | } 15 | 16 | [public] 17 | method peekByte() returns byte{ 18 | return bytes[this.position] 19 | } 20 | 21 | [public] 22 | method peekBytes(int count) returns list{ 23 | var l = readBytes(count) 24 | this.position -= count 25 | return l 26 | } 27 | 28 | [public] 29 | method readByte() returns byte{ 30 | var b = peekByte() 31 | this.position++ 32 | return b 33 | } 34 | 35 | [public] 36 | method readBytes(int count) returns list{ 37 | var list l = list[] 38 | repeat(count){ 39 | l.add(readByte()) 40 | } 41 | return l 42 | } 43 | 44 | [public] 45 | method writeByte(byte b){ 46 | bytes.insert(this.position, b) 47 | b++ 48 | } 49 | 50 | [public] 51 | method writeBytes(list bytes){ 52 | bytes.insertElements(this.position, bytes) 53 | this.position += bytes.length 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /stdlib/io/Stream.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | [abstract] 3 | class Stream{ 4 | 5 | [public] 6 | property int position 7 | 8 | [public] 9 | [deprecated] 10 | method getPosition() returns int{ 11 | return position 12 | } 13 | 14 | [public] 15 | [deprecated] 16 | method setPosition(int position){ 17 | position = position 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/io/directories.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function exists_directory(string path) returns bool{ 3 | return bool(implement("io.directory.exists", path)) 4 | } 5 | 6 | [public] 7 | function create_directory(string path){ 8 | implement("io.directory.create", path) 9 | } 10 | 11 | [public] 12 | function delete_directory(string path){ 13 | implement("io.directory.delete", path) 14 | } 15 | 16 | [public] 17 | function full_directory_path(string path) returns string{ 18 | return string(implement("io.path.get_directory_path", path)) 19 | } 20 | 21 | [public] 22 | function directory_name(string path) returns string{ 23 | return string(implement("io.path.get_directory_name", path)) 24 | } 25 | 26 | [public] 27 | function directories(string path) returns list{ 28 | return list(implement("io.directory.list", path)) 29 | } 30 | 31 | [public] 32 | function get_home_directory() returns string{ 33 | return string(implement("io.directory.get_home_directory")) 34 | } -------------------------------------------------------------------------------- /stdlib/io/files.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function exists_file(string path) returns bool{ 3 | return bool(implement("io.file.exists", path)) 4 | } 5 | 6 | [public] 7 | function read_file(string path) returns string{ 8 | return string(implement("io.file.read_string", path)) 9 | } 10 | 11 | [public] 12 | function read_file_bytes(string path) returns list{ 13 | return list(implement("io.file.read_bytes", path)) 14 | } 15 | 16 | [public] 17 | function write_file(string path, string data){ 18 | implement("io.file.write_string", path, data) 19 | } 20 | 21 | [public] 22 | function write_file_bytes(string path, list data){ 23 | implement("io.file.write_bytes", path, data) 24 | } 25 | 26 | [public] 27 | function file_name(string path) returns string{ 28 | return string(implement("io.path.get_file_name", path)) 29 | } 30 | 31 | [public] 32 | function delete_file(string path){ 33 | implement("io.file.delete", path) 34 | } 35 | 36 | [public] 37 | function files(string path) returns list{ 38 | return list(implement("io.file.list", path)) 39 | } -------------------------------------------------------------------------------- /stdlib/io/glob.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function glob(string pattern) returns list{ 3 | return list(implement("io.glob.search", pattern)) 4 | } -------------------------------------------------------------------------------- /stdlib/io/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/io/path.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function abs(string relative) returns string{ 3 | return string(implement("io.path.relative_to_absolute", relative)) 4 | } 5 | 6 | [public] 7 | function join_path(list paths) returns string{ 8 | var string path = "" 9 | var int i = 0 10 | foreach(paths as p){ 11 | path += p 12 | if(i < paths.length - 1){ 13 | path += "/" 14 | } 15 | i++ 16 | } 17 | return path 18 | } 19 | 20 | [public] 21 | function get_executable_path() returns string{ 22 | return string(implement("io.path.get_current_executable_path")) 23 | } 24 | 25 | [public] 26 | function copy(string from, string to){ 27 | implement("io.path.copy", from, to) 28 | } 29 | 30 | [public] 31 | function move(string from, string to){ 32 | implement("io.path.move", from, to) 33 | } -------------------------------------------------------------------------------- /stdlib/io/symlink.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function create_symlink(string origin, string target){ 3 | implement("io.create_symlink", origin, target) 4 | } -------------------------------------------------------------------------------- /stdlib/json/Token.aspl: -------------------------------------------------------------------------------- 1 | class Token { 2 | 3 | [readpublic] 4 | property TokenType type 5 | [readpublic] 6 | property string value 7 | [readpublic] 8 | property int length 9 | 10 | [public] 11 | method construct(TokenType type, string value, int length) { 12 | this.type = type 13 | this.value = value 14 | this.length = length 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /stdlib/json/TokenList.aspl: -------------------------------------------------------------------------------- 1 | class TokenList{ 2 | 3 | property list* tokens 4 | property int position 5 | 6 | [public] 7 | method construct(list tokens){ 8 | this.tokens = &tokens 9 | } 10 | 11 | [public] 12 | method peek(int amount = 0) returns Token{ 13 | return (*tokens)[position + amount] 14 | } 15 | 16 | [public] 17 | method shift(int amount = 1){ 18 | position += amount 19 | } 20 | 21 | [public] 22 | method next(int offset = 0) returns Token{ 23 | var Token token = (*tokens)[position + offset] 24 | shift(offset + 1) 25 | return token 26 | } 27 | 28 | [public] 29 | method count() returns int{ 30 | return (*tokens).length - position 31 | } 32 | 33 | [public] 34 | method empty() returns bool{ 35 | return count() == 0 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /stdlib/json/TokenType.aspl: -------------------------------------------------------------------------------- 1 | enum TokenType { 2 | Null, 3 | True, 4 | False, 5 | Integer, 6 | Float, 7 | String, 8 | BracketOpen, 9 | BracketClose, 10 | BraceOpen, 11 | BraceClose, 12 | Colon, 13 | Comma 14 | } -------------------------------------------------------------------------------- /stdlib/json/main.aspl: -------------------------------------------------------------------------------- 1 | $if main{ 2 | assert decode(encode(null)) == null 3 | assert decode(encode(101)) == 101 4 | assert decode(encode(101f)) == 101f 5 | assert decode(encode("Hello")) == "Hello" 6 | assert decode(encode(list[])) == list[] 7 | assert decode(encode(list["42"])) == ["42"] 8 | assert decode(encode(list["42", "43", 0, -12, "Hello", null])) == list["42", "43", 0, -12, "Hello", null] 9 | } -------------------------------------------------------------------------------- /stdlib/math/abs.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function abs(double x) returns double{ 3 | if(x > 0){ 4 | return x 5 | }else{ 6 | return double(-x) 7 | } 8 | } -------------------------------------------------------------------------------- /stdlib/math/angular_units.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function radians(double degrees) returns double{ 3 | return double(degrees / 180 * pi()) 4 | } 5 | 6 | [public] 7 | function degrees(double radians) returns double{ 8 | return double(radians / pi() * 180) 9 | } -------------------------------------------------------------------------------- /stdlib/math/comparison.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function min(double a, double b) returns double{ 3 | if(a < b){ 4 | return a 5 | } 6 | return b 7 | } 8 | 9 | [public] 10 | function max(double a, double b) returns double{ 11 | if(a > b){ 12 | return a 13 | } 14 | return b 15 | } 16 | 17 | [public] 18 | function clamp(double value, double min, double max) returns double{ 19 | if(value < min){ 20 | return min 21 | }elseif(value > max){ 22 | return max 23 | } 24 | return value 25 | } -------------------------------------------------------------------------------- /stdlib/math/constants.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function pi() returns double{ 3 | return 3.141592653589793d 4 | } 5 | 6 | [public] 7 | function e() returns double{ 8 | return 2.718281828459045d 9 | } -------------------------------------------------------------------------------- /stdlib/math/geometry/Ellipse.aspl: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | [public] 4 | class Ellipse{ 5 | 6 | [readpublic] 7 | property Point position 8 | [readpublic] 9 | property Size size 10 | 11 | [public] 12 | method construct(Point position, Size size){ 13 | this.position = position 14 | this.size = size 15 | } 16 | 17 | [public] 18 | method containsPoint(Point point) returns bool{ 19 | var x = point.x - this.position.x 20 | var y = point.y - this.position.y 21 | var a = this.size.width / 2 22 | var b = this.size.height / 2 23 | return (x * x) / (a * a) + (y * y) / (b * b) <= 1 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /stdlib/math/geometry/Point.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class Point{ 3 | 4 | [readpublic] 5 | property float x 6 | [readpublic] 7 | property float y 8 | 9 | [public] 10 | method construct(float x, float y){ 11 | this.x = x 12 | this.y = y 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /stdlib/math/geometry/Rectangle.aspl: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | [public] 4 | class Rectangle{ 5 | 6 | [readpublic] 7 | property Point position 8 | [readpublic] 9 | property Size size 10 | 11 | [public] 12 | method construct(Point position, Size size){ 13 | this.position = position 14 | this.size = size 15 | } 16 | 17 | [public] 18 | method containsPoint(Point point) returns bool{ 19 | return point.x >= position.x && point.x <= position.x + size.width && point.y >= position.y && point.y <= position.y + size.height 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /stdlib/math/geometry/Size.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class Size{ 3 | 4 | [readpublic] 5 | property float width 6 | [readpublic] 7 | property float height 8 | 9 | [public] 10 | method construct(float width, float height){ 11 | this.width = width 12 | this.height = height 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /stdlib/math/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/math/pow.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function pow(double base, double exponent) returns double{ 3 | return double(implement("math.pow", base, exponent)) 4 | } 5 | 6 | [public] 7 | function root(double x, double n) returns double{ 8 | return pow(x, 1d / n) 9 | } 10 | 11 | [public] 12 | function sqrt(double x) returns double{ 13 | return root(x, 2d) 14 | } -------------------------------------------------------------------------------- /stdlib/math/round.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function floor(double x) returns double{ 3 | return double(implement("math.floor", x)) 4 | } 5 | 6 | [public] 7 | function ceil(double x) returns double{ 8 | return double(-floor(-x)) 9 | } 10 | 11 | [public] 12 | function round(double x, int d = 0) returns double{ 13 | return double(implement("math.round", x, d)) 14 | } -------------------------------------------------------------------------------- /stdlib/math/trigonometry.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function sin(double x) returns double{ 3 | return double(implement("math.sin", x)) 4 | } 5 | 6 | [public] 7 | function asin(double x) returns double{ 8 | return double(implement("math.asin", x)) 9 | } 10 | 11 | [public] 12 | function cos(double x) returns double{ 13 | return double(implement("math.cos", x)) 14 | } 15 | 16 | [public] 17 | function acos(double x) returns double{ 18 | return double(implement("math.acos", x)) 19 | } 20 | 21 | [public] 22 | function tan(double x) returns double{ 23 | return double(implement("math.tan", x)) 24 | } 25 | 26 | [public] 27 | function atan(double x) returns double{ 28 | return double(implement("math.atan", x)) 29 | } -------------------------------------------------------------------------------- /stdlib/os/Architecture.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | enum Architecture{ 3 | amd64, // aka x86_64 4 | arm64, // 64-bit arm 5 | arm32, // 32-bit arm 6 | rv64, // 64-bit risc-v 7 | rv32, // 32-bit risc-v 8 | i386 // aka x86_32 9 | } 10 | 11 | [public] 12 | function architecture_from_string(string arch) returns Architecture? { 13 | arch = arch.toLower() 14 | if(arch == "amd64" || arch == "x86_64" || arch == "x64") { 15 | return Architecture.amd64 16 | }elseif(arch == "arm64" || arch == "aarch64") { 17 | return Architecture.arm64 18 | }elseif(arch == "arm32" || arch == "aarch32") { 19 | return Architecture.arm32 20 | }elseif(arch == "rv64" || arch == "riscv64" || arch == "risc-v64") { 21 | return Architecture.rv64 22 | }elseif(arch == "rv32" || arch == "riscv32" || arch == "risc-v32") { 23 | return Architecture.rv32 24 | }elseif(arch == "i386" || arch == "x86_32"|| arch == "x86" || arch == "x32" || arch == "ia-32" || arch == "ia32") { 25 | return Architecture.i386 26 | }else{ 27 | return null 28 | } 29 | } -------------------------------------------------------------------------------- /stdlib/os/CommandResult.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class CommandResult { 3 | 4 | [readpublic] 5 | property int exitCode 6 | [readpublic] 7 | property string output 8 | 9 | [public] 10 | method construct(int exitCode, string output) { 11 | this.exitCode = exitCode 12 | this.output = output 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /stdlib/os/args.aspl: -------------------------------------------------------------------------------- 1 | // args returns the cli arguments passed to the currently running process 2 | // note: the first argument is usually the path to the executable 3 | [public] 4 | function args() returns list{ 5 | return list(implement("os.get_current_program_arguments")) 6 | } -------------------------------------------------------------------------------- /stdlib/os/commands.aspl: -------------------------------------------------------------------------------- 1 | // execute executes a program and returns the exit code and the output 2 | [public] 3 | function execute(string command) returns CommandResult{ 4 | var result = list(implement("os.command.execute", command)) 5 | return new CommandResult(int(result[0]), string(result[1])) 6 | } 7 | 8 | // system executes a program (like os.execute()), but only returns the exit code 9 | [public] 10 | function system(string command) returns int{ 11 | return int(implement("os.command.system", command)) 12 | } 13 | 14 | // execvp executes a program in place of the current process 15 | // Note: this function does not return if successful 16 | [public] 17 | function execvp(string command, list args){ 18 | implement("os.command.execvp", command, args) 19 | } -------------------------------------------------------------------------------- /stdlib/os/fs.aspl: -------------------------------------------------------------------------------- 1 | // getwd returns the current working directory 2 | [public] 3 | function getwd() returns string{ 4 | return string(implement("os.get_working_directory")) 5 | } 6 | 7 | // chdir changes the current working directory to the specified path 8 | [public] 9 | function chdir(string path){ 10 | implement("os.change_working_directory", path) 11 | } 12 | 13 | // chmod changes the mode of the specified file to the specified mode 14 | [public] 15 | function chmod(string path, int mode){ 16 | implement("os.change_mode", path, mode) 17 | } 18 | 19 | // create_temp_dir creates and returns a unique ephemeral directory suitable for storing temporary files 20 | [public] 21 | function create_temp_dir() returns string{ 22 | return string(implement("os.create_temporary_directory")) 23 | } -------------------------------------------------------------------------------- /stdlib/os/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/os/os.aspl: -------------------------------------------------------------------------------- 1 | // user_os returns the name of the operating system currently used to execute this program 2 | [public] 3 | function user_os() returns string{ 4 | return string(implement("os.get_current_runtime_os_name")) 5 | } 6 | 7 | // user_architecture returns the name of the architecture currently used to execute this program 8 | [public] 9 | function user_architecture() returns string{ 10 | return string(implement("os.get_current_runtime_architecture_name")) 11 | } 12 | 13 | // user_architecture_generic returns a value from the Architecture enum and is more generic than os.user_architecture() 14 | [public] 15 | function user_architecture_generic() returns Architecture{ 16 | return Architecture(int(implement("os.get_current_runtime_architecture_enum"))) 17 | } -------------------------------------------------------------------------------- /stdlib/rand/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/rand/main.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function brange(byte min, byte max) returns byte{ 3 | return byte(implement("random.range.byte", min, max)) 4 | } 5 | 6 | [public] 7 | function irange(int min, int max) returns int{ 8 | return int(implement("random.range.int", min, max)) 9 | } 10 | 11 | [public] 12 | function lrange(long min, long max) returns long{ 13 | return long(implement("random.range.long", min, max)) 14 | } 15 | 16 | [public] 17 | function frange(float min, float max) returns float{ 18 | return float(implement("random.range.float", min, max)) 19 | } 20 | 21 | [public] 22 | function drange(double min, double max) returns double{ 23 | return double(implement("random.range.double", min, max)) 24 | } 25 | 26 | [public] 27 | function byte() returns byte{ 28 | return brange(0b, 255b) 29 | } 30 | 31 | [public] 32 | function float() returns float{ 33 | return frange(0f, 1f) 34 | } -------------------------------------------------------------------------------- /stdlib/regex/Match.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class Match{ 3 | 4 | [readpublic] 5 | property int start 6 | [readpublic] 7 | property int end 8 | [readpublic] 9 | property string value 10 | 11 | [public] 12 | method construct(int start, int end, string value){ 13 | this.start = start 14 | this.end = end 15 | this.value = value 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /stdlib/regex/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/regex/regex.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function find_first(string pattern, string haystack) returns Match?{ 3 | var data = implement("regex.find_first", pattern, haystack) 4 | if(data == null){ 5 | return null 6 | } 7 | var list match = list(data) 8 | return new Match(int(match[0]), int(match[1]), string(match[2])) 9 | } 10 | 11 | [public] 12 | function match_string(string pattern, string haystack) returns Match?{ 13 | var data = implement("regex.match", pattern, haystack) 14 | if(data == null){ 15 | return null 16 | } 17 | var list match = list(data) 18 | return new Match(int(match[0]), int(match[1]), string(match[2])) 19 | } 20 | 21 | [public] 22 | function replace_first(string pattern, string replace, string haystack) returns string{ 23 | return string(implement("regex.replace_first", pattern, replace, haystack)) 24 | } 25 | 26 | [public] 27 | function find_all(string pattern, string haystack) returns list{ 28 | var list> data = list>(implement("regex.find_all", pattern, haystack)) 29 | var list matches = [] 30 | foreach(data as match){ 31 | matches.add(new Match(int(match[0]), int(match[1]), string(match[2]))) 32 | } 33 | return matches 34 | } 35 | 36 | [public] 37 | function replace_all(string pattern, string replace, string haystack) returns string{ 38 | return string(implement("regex.replace_all", pattern, replace, haystack)) 39 | } -------------------------------------------------------------------------------- /stdlib/sqlite/Database.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class Database { 3 | 4 | property any handle 5 | 6 | [public] 7 | method construct(string file){ 8 | handle = implement("sqlite.database.open", file) 9 | } 10 | 11 | [public] 12 | method prepare(string query) returns Statement{ 13 | return new Statement(implement("sqlite.database.prepare", handle, query)) 14 | } 15 | 16 | [public] 17 | method query(string query) returns Response{ 18 | return new Response(implement("sqlite.database.query", handle, query)) 19 | } 20 | 21 | [public] 22 | method close(){ 23 | implement("sqlite.database.close", handle) 24 | handle = null 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /stdlib/sqlite/Response.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class Response { 3 | 4 | property any handle 5 | 6 | [public] 7 | method construct(any handle){ 8 | this.handle = handle 9 | } 10 | 11 | [public] 12 | method fetchRow() returns map?{ 13 | // TODO: Shorten this implementation using casts when something like map?(...) actually works with the ASPL compiler 14 | var row = implement("sqlite.response.fetch_row", handle) 15 | if(row == null){ 16 | return null 17 | }else{ 18 | return map(row) 19 | } 20 | } 21 | 22 | [public] 23 | method fetchRows() returns list>{ 24 | var list> rows = [] 25 | while(true){ 26 | var row = fetchRow() 27 | if(row == null){ 28 | return rows 29 | } 30 | rows.add(row?!) 31 | } 32 | } 33 | 34 | [public] 35 | method finalize(){ 36 | implement("sqlite.response.finalize", handle) 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /stdlib/sqlite/Statement.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class Statement { 3 | 4 | property any handle 5 | 6 | method construct(any handle){ 7 | this.handle = handle 8 | } 9 | 10 | [public] 11 | method bind(string parameter, any value){ 12 | implement("sqlite.statement.bind", handle, parameter, value) 13 | } 14 | 15 | [public] 16 | method execute() returns Response{ 17 | return new Response(implement("sqlite.statement.execute", handle)) 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /stdlib/sqlite/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/strings/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/time/Timestamp.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | class Timestamp { 3 | 4 | [readpublic] 5 | property long nanoseconds // since the Unix epoch 6 | [public] 7 | property long microseconds{ 8 | get{ 9 | return nanoseconds / 1000 10 | } 11 | } 12 | [public] 13 | property long milliseconds{ 14 | get{ 15 | return nanoseconds / 1000000 16 | } 17 | } 18 | [public] 19 | property long seconds{ 20 | get{ 21 | return nanoseconds / 1000000000 22 | } 23 | } 24 | 25 | [public] 26 | method construct(long nanoseconds){ 27 | this.nanoseconds = nanoseconds 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /stdlib/time/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/time/sleep.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function sleep(long seconds){ 3 | implement("time.nanosleep", seconds * 1000000000) 4 | } 5 | 6 | [public] 7 | function millisleep(long milliseconds){ 8 | implement("time.nanosleep", milliseconds * 1000000) 9 | } 10 | 11 | [public] 12 | function microsleep(long microseconds){ 13 | implement("time.nanosleep", microseconds * 1000) 14 | } 15 | 16 | [public] 17 | function nanosleep(long nanoseconds){ 18 | implement("time.nanosleep", nanoseconds) 19 | } -------------------------------------------------------------------------------- /stdlib/time/time.aspl: -------------------------------------------------------------------------------- 1 | // now returns the current time since the Unix Epoch (UTC) 2 | [public] 3 | function now() returns Timestamp{ 4 | return new Timestamp(long(implement("time.nanotime_utc"))) 5 | } 6 | 7 | // local returns the current time since the Unix Epoch (local timezone) 8 | [public] 9 | function local() returns Timestamp{ 10 | return new Timestamp(long(implement("time.nanotime_local"))) 11 | } -------------------------------------------------------------------------------- /stdlib/zip/implementations/implementations.aspl: -------------------------------------------------------------------------------- 1 | $if !twailbackend{ 2 | $include("implementations.c") 3 | } -------------------------------------------------------------------------------- /stdlib/zip/zip.aspl: -------------------------------------------------------------------------------- 1 | [public] 2 | function unzip(string file, string folder){ 3 | implement("zip.extract_file_to_directory", file, folder) 4 | } 5 | 6 | [public] 7 | function zip_folder(string folder, string file){ 8 | implement("zip.create_archive_from_directory", file, folder) 9 | } 10 | 11 | [public] 12 | function zip_files(list files, string file){ 13 | implement("zip.create_archive_from_files", file, files) 14 | } -------------------------------------------------------------------------------- /templates/linux/arm32/full/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /templates/linux/arm32/minimal/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /templates/linux/x86_64/full/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /templates/linux/x86_64/minimal/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /templates/macos/x86_64/full/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /templates/macos/x86_64/minimal/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /templates/windows/x86_64/full/cli/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /templates/windows/x86_64/minimal/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /tests/abstracts/Child.aspl: -------------------------------------------------------------------------------- 1 | class Child extends Parent { 2 | 3 | [public] 4 | method one(){ 5 | print("child: one") 6 | } 7 | 8 | [public] 9 | method three(){ 10 | print("child: three") 11 | } 12 | 13 | [public] 14 | method four(){ 15 | print("child: four") 16 | } 17 | 18 | [public] 19 | method five(){ 20 | print("child: five") 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /tests/abstracts/GrandParentOne.aspl: -------------------------------------------------------------------------------- 1 | [abstract] 2 | class GrandParentOne { 3 | 4 | [public] 5 | [abstract] 6 | method three() 7 | 8 | } -------------------------------------------------------------------------------- /tests/abstracts/GrandParentTwo.aspl: -------------------------------------------------------------------------------- 1 | [abstract] 2 | class GrandParentTwo { 3 | 4 | [public] 5 | [abstract] 6 | method four() 7 | 8 | [public] 9 | method five(){ 10 | print("grand parent two: five") 11 | } 12 | 13 | [public] 14 | method six(){ 15 | print("grand parent two: six") 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /tests/abstracts/Parent.aspl: -------------------------------------------------------------------------------- 1 | [abstract] 2 | class Parent extends GrandParentOne, GrandParentTwo { 3 | 4 | [public] 5 | [abstract] 6 | method one() 7 | 8 | [public] 9 | method two(){ 10 | print("parent: two") 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /tests/abstracts/main.aspl: -------------------------------------------------------------------------------- 1 | var child = new Child() 2 | child.one() 3 | child.two() 4 | child.three() 5 | child.four() 6 | child.five() 7 | child.six() -------------------------------------------------------------------------------- /tests/arithmetic/arithmetic.aspl: -------------------------------------------------------------------------------- 1 | assert 2 + 3 == 5 2 | assert 10 - 2 == 8 3 | assert 10 - 11 == -1 4 | assert 2 * 4 == 8 5 | assert -2 * 4 == 2 * -4 6 | assert 9 / 3 == 3 7 | assert -9 / 3 == -3 8 | assert 9 / -3 == -3 9 | assert 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 == 45 10 | assert 5 * (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9) == 5 * 45 11 | 12 | assert 2 * 3 + 1 * 3 == (2 * 3) + (1 * 3) 13 | assert 5 / 2 + 1 / 3 == (5 / 2) + (1 / 3) 14 | 15 | assert 2 > 1 16 | assert 2 >= 1 17 | assert 1 < 2 18 | assert 1 <= 2 19 | assert 2 >= 2 20 | assert 2 <= 2 21 | assert !(2 > 3) 22 | assert !(2 >= 3) 23 | assert !(-1 < -2) 24 | assert !(-1 <= -2) -------------------------------------------------------------------------------- /tests/attributes/Example.aspl: -------------------------------------------------------------------------------- 1 | [description("An example class")] 2 | class Example { 3 | 4 | property int x = [0][0] // test to ensure attributes and list indexing is not mixed up 5 | 6 | [deprecated("Use the other property x")] 7 | property list y = [0] // test to ensure attributes and list indexing is not mixed up 8 | 9 | [public] 10 | [deprecated] 11 | method hello(){ 12 | print("Hello from Example!") 13 | print(this.y) 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /tests/attributes/main.aspl: -------------------------------------------------------------------------------- 1 | var Example example = new Example() 2 | example.hello() -------------------------------------------------------------------------------- /tests/blocks/blocks.aspl: -------------------------------------------------------------------------------- 1 | var a = 0 2 | { 3 | var b = "Hello" 4 | print(b) 5 | print(a) 6 | a = 1 7 | } 8 | print(a) -------------------------------------------------------------------------------- /tests/boolean_operators/boolean_operators.aspl: -------------------------------------------------------------------------------- 1 | assert !true == false 2 | assert !false == true 3 | 4 | assert (true || false) == true 5 | assert (true || true) == true 6 | assert (false || false) == false 7 | assert (false || true) == true 8 | 9 | assert (true && false) == false 10 | assert (true && true) == true 11 | assert (false && false) == false 12 | assert (false && true) == false 13 | 14 | assert (true ^ false) == true 15 | assert (true ^ true) == false 16 | assert (false ^ false) == false 17 | assert (false ^ true) == true -------------------------------------------------------------------------------- /tests/break_and_continue/break_and_continue.aspl: -------------------------------------------------------------------------------- 1 | // TODO: Enable this test again (break & continue levels are currently not supported in all backends) 2 | /*var x = 0 3 | var y = 0 4 | var z = 0 5 | repeat(10){ 6 | if(x == 5){ 7 | while(true){ 8 | if(z == 10){ 9 | break 2 10 | } 11 | z++ 12 | } 13 | } 14 | x++ 15 | if(x == 3){ 16 | continue 17 | } 18 | y++ 19 | } 20 | assert x == 5 21 | assert y == 4 22 | assert z == 10*/ 23 | assert true // required last statement in file -------------------------------------------------------------------------------- /tests/callbacks/callbacks.aspl: -------------------------------------------------------------------------------- 1 | var x = callback(list number) returns int|float{ 2 | return number[0] * 2 3 | } 4 | var callback, returns int|float> c = x 5 | print(c) 6 | assert c.invoke([100]) == c.([100]) 7 | assert c.([20]) == 40 8 | assert c.([-10]) == -20 -------------------------------------------------------------------------------- /tests/casting/casting.aspl: -------------------------------------------------------------------------------- 1 | assert int(1f) == 1 2 | assert int(1.0) == 1 3 | assert int(1) == 1 4 | assert string(1) == "1" 5 | assert int(string(1)) == 1 -------------------------------------------------------------------------------- /tests/classes/Example.aspl: -------------------------------------------------------------------------------- 1 | class Example extends ParentOne, ParentTwo { 2 | 3 | [public] 4 | property int number = 42 5 | [public] 6 | property bool isImportantProperty 7 | [public] 8 | property bool alwaysTrue{ 9 | get{ 10 | return true 11 | } 12 | set{ 13 | // do nothing 14 | } 15 | } 16 | 17 | [static] 18 | property bool someStaticProperty = true 19 | 20 | [public] 21 | method construct(){ 22 | print("Creating new instance of Example...") 23 | assert number == 42 24 | number = 43 25 | assert number == 43 26 | number = 42 27 | assert someStaticProperty == true 28 | someStaticProperty = false 29 | assert someStaticProperty == false 30 | someStaticProperty = true 31 | assert getNumber() == 42 32 | assert get10() == 10 33 | } 34 | 35 | [public] 36 | method hello(){ 37 | print("Hello from example!") 38 | } 39 | 40 | [static] 41 | method get10() returns int{ 42 | return 10 43 | } 44 | 45 | [public] 46 | method getNumber() returns int{ 47 | return this.number 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /tests/classes/GrandParent.aspl: -------------------------------------------------------------------------------- 1 | class GrandParent { 2 | 3 | [public] 4 | property int grandParentProperty = -100 5 | 6 | [public] 7 | method grandParentMethod(){ 8 | print("Hello from grandparent!") 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /tests/classes/ParentOne.aspl: -------------------------------------------------------------------------------- 1 | class ParentOne extends GrandParent { 2 | 3 | [public] 4 | property int parentOneProperty = 100 5 | 6 | [public] 7 | method parentOneMethod(){ 8 | print("Hello from parent 1!") 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /tests/classes/ParentTwo.aspl: -------------------------------------------------------------------------------- 1 | class ParentTwo { 2 | 3 | [public] 4 | property int parentTwoProperty = 200 5 | 6 | [public] 7 | method parentTwoMethod(){ 8 | print("Hello from parent 2!") 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /tests/classes/main.aspl: -------------------------------------------------------------------------------- 1 | var example = new Example() 2 | print(example) 3 | example.hello() 4 | example.parentOneMethod() 5 | example.parentTwoMethod() 6 | example.grandParentMethod() 7 | print(example.parentOneProperty) 8 | print(example.parentTwoProperty) 9 | print(example.grandParentProperty) 10 | assert example.getNumber() == 42 11 | example.number = 10 12 | assert example.getNumber() == 10 13 | assert !example.isImportantProperty 14 | assert example.alwaysTrue 15 | example.alwaysTrue = false 16 | assert example.alwaysTrue -------------------------------------------------------------------------------- /tests/closures/closures.aspl: -------------------------------------------------------------------------------- 1 | function main() returns callback{ 2 | var outer = 42 3 | var cross = "Default" 4 | var c = callback() returns int{ 5 | cross = "from the inner scope" 6 | var inner = null 7 | return outer 8 | } 9 | assert cross == "Default" 10 | return c 11 | } 12 | 13 | assert main().invoke() == 42 -------------------------------------------------------------------------------- /tests/compile_time/compile_time.aspl: -------------------------------------------------------------------------------- 1 | $if windows{ 2 | print("Windows") 3 | } 4 | $if !windows{ 5 | print("Not on windows") 6 | } -------------------------------------------------------------------------------- /tests/divideequals/divideequals.aspl: -------------------------------------------------------------------------------- 1 | var i = 10 2 | i /= 2 3 | assert i == 5 -------------------------------------------------------------------------------- /tests/enums/Options.aspl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspl-lang/aspl/e37b19f1387ba2531dc6ab8a603f5e6ad6eace0e/tests/enums/Options.aspl -------------------------------------------------------------------------------- /tests/enums/Persons.aspl: -------------------------------------------------------------------------------- 1 | [description("An example enum")] 2 | enum Persons{ 3 | [deprecated] 4 | [description("This is the first person")] 5 | John, 6 | [description("This is the second person")] 7 | Maria, 8 | Lewis = 4, 9 | Leo = 5 10 | } -------------------------------------------------------------------------------- /tests/enums/main.aspl: -------------------------------------------------------------------------------- 1 | print(Persons.John) 2 | assert Persons.John != Persons.Maria 3 | 4 | print(Options.Debug || Options.TestAll) 5 | assert ((Options.Debug || Options.TestAll) && Options.Debug) != 0 6 | 7 | [flags] 8 | enum Options { 9 | Debug, 10 | TestAll, 11 | Deploy 12 | } -------------------------------------------------------------------------------- /tests/equality/equality.aspl: -------------------------------------------------------------------------------- 1 | var a = 0 2 | var b = 0 3 | assert a == b 4 | var c = 1 5 | assert a != c 6 | assert b != c 7 | assert c == 1 8 | var d = "hello" 9 | assert d == "hello" 10 | assert d != "world" 11 | assert d != "hello world" 12 | assert d != a -------------------------------------------------------------------------------- /tests/folders/main.aspl: -------------------------------------------------------------------------------- 1 | top() 2 | middle.middle() 3 | middle.deep.deep() 4 | 5 | folders.top() 6 | folders.middle.middle() 7 | folders.middle.deep.deep() -------------------------------------------------------------------------------- /tests/folders/middle/deep/deep.aspl: -------------------------------------------------------------------------------- 1 | function deep(){ 2 | print("Hello from the deep level folder") 3 | } -------------------------------------------------------------------------------- /tests/folders/middle/middle.aspl: -------------------------------------------------------------------------------- 1 | function middle(){ 2 | print("Hello from the middle level folder") 3 | } -------------------------------------------------------------------------------- /tests/folders/top.aspl: -------------------------------------------------------------------------------- 1 | function top(){ 2 | print("Hello from the top level folder") 3 | } -------------------------------------------------------------------------------- /tests/foreach/foreach.aspl: -------------------------------------------------------------------------------- 1 | var map m = map{} 2 | foreach([3, 4, 5] as index => element){ 3 | m[index] = element 4 | } 5 | assert m == {0 => 3, 1 => 4, 2 => 5} 6 | var s = "" 7 | foreach("Hello World!" as c){ 8 | s += c 9 | } 10 | assert s == "Hello World!" 11 | foreach({"Hello" => "World"} as key => value){ 12 | print(key + ": " + value) 13 | } -------------------------------------------------------------------------------- /tests/functions/functions.aspl: -------------------------------------------------------------------------------- 1 | function f(integer x) returns int|float{ 2 | return x 3 | } 4 | 5 | function pretty_print(any x){ 6 | print("---") 7 | print(x) 8 | print("---") 9 | } 10 | 11 | pretty_print(f(3)) -------------------------------------------------------------------------------- /tests/hello_world/hello_world.aspl: -------------------------------------------------------------------------------- 1 | print("Hello World!") -------------------------------------------------------------------------------- /tests/if/if.aspl: -------------------------------------------------------------------------------- 1 | var a = false 2 | if(true){ 3 | a = true 4 | }elseif(true){ 5 | assert false // unreachable because of previous if 6 | }else{ 7 | assert false // unreachable because of previous if 8 | } 9 | if(false){ 10 | assert false // unreachable because condition is false 11 | }elseif(false){ 12 | assert false // unreachable because condition is false 13 | }else{ 14 | assert a 15 | } 16 | var b = false 17 | if(false){ 18 | assert false // unreachable because condition is false 19 | }elseif(true){ 20 | b = true 21 | }else{ 22 | b = false // unreachable because of previous elseif 23 | } 24 | assert b -------------------------------------------------------------------------------- /tests/implementation_calls/implementation_calls.aspl: -------------------------------------------------------------------------------- 1 | import time // needed to include the implementations in some backends 2 | import math 3 | 4 | assert implement("time.nanotime_utc") > 0 5 | print(implement("time.nanotime_utc")) 6 | assert implement("math.round", 0.6d, 0) == 1d -------------------------------------------------------------------------------- /tests/imports/classes/Example.aspl: -------------------------------------------------------------------------------- 1 | class Example {} -------------------------------------------------------------------------------- /tests/imports/main.aspl: -------------------------------------------------------------------------------- 1 | import imports.classes 2 | 3 | var example = new Example() 4 | print(example) -------------------------------------------------------------------------------- /tests/lists/lists.aspl: -------------------------------------------------------------------------------- 1 | var l = ["Hello", "World"] 2 | var list x = l 3 | l.add("!") 4 | l.add("?") 5 | assert x.length == 4 6 | x.removeAt(3) 7 | assert l.length == 3 8 | assert x.length == 3 9 | assert x[0] == l[0] 10 | assert x[1] == l[1] 11 | assert x[2] != l[1] 12 | assert x[2] == "!" 13 | x[2] = "?" 14 | assert l[2] == "?" 15 | print(x) -------------------------------------------------------------------------------- /tests/maps/maps.aspl: -------------------------------------------------------------------------------- 1 | var m = {"Hello" => "World", "Foo" => "Bar"} 2 | var map x = m 3 | assert x.length == 2 4 | x.remove("Hello") 5 | assert m.length == 1 6 | assert x.length == 1 7 | assert x["Foo"] == "Bar" 8 | m["AS"] = "PL" 9 | assert m["AS"] == "PL" 10 | assert m["AS"] != x["Foo"] 11 | x["AS"] = "..." 12 | assert m["AS"] == "..." 13 | print(x) -------------------------------------------------------------------------------- /tests/methods/methods.aspl: -------------------------------------------------------------------------------- 1 | print("Hello".toLower()) -------------------------------------------------------------------------------- /tests/minusequals/minusequals.aspl: -------------------------------------------------------------------------------- 1 | var i = 1 2 | i -= 5 3 | assert i == -4 -------------------------------------------------------------------------------- /tests/minusminus/minusminus.aspl: -------------------------------------------------------------------------------- 1 | var int i = 0 2 | i-- 3 | assert i == -1 4 | assert i-- == -2 -------------------------------------------------------------------------------- /tests/modules/modules.aspl: -------------------------------------------------------------------------------- 1 | /* 2 | This test only works with a module called "example" installed 3 | import example 4 | 5 | print(example.add(1, 2)) 6 | print(example.subfolder.stringAdd("Hello", "World")) 7 | */ 8 | assert true -------------------------------------------------------------------------------- /tests/moduloequals/moduloequals.aspl: -------------------------------------------------------------------------------- 1 | var i = 14 2 | i %= 3 3 | assert i == 2 -------------------------------------------------------------------------------- /tests/multiplyequals/multiplyequals.aspl: -------------------------------------------------------------------------------- 1 | var i = 3 2 | i *= 4 3 | assert i == 12 -------------------------------------------------------------------------------- /tests/nullable/nullable.aspl: -------------------------------------------------------------------------------- 1 | var int? i = 0 2 | i = null 3 | assert i == null 4 | i = 10 5 | assert i == 10 6 | assert i?! == 10 -------------------------------------------------------------------------------- /tests/oftype/oftype.aspl: -------------------------------------------------------------------------------- 1 | assert "Hello" oftype string 2 | assert !("Hello" oftype int) 3 | var a = 10 4 | assert a oftype int 5 | assert !(a oftype float) -------------------------------------------------------------------------------- /tests/parent_method_calls/Child.aspl: -------------------------------------------------------------------------------- 1 | class Child extends Parent { 2 | 3 | [public] 4 | method getValue() returns int{ 5 | return parent(Parent).getValue() + 1 6 | } 7 | 8 | [public] 9 | method getValueWithArg(int x) returns int{ 10 | return parent(Parent).getValueWithArg(x) + 5 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /tests/parent_method_calls/Parent.aspl: -------------------------------------------------------------------------------- 1 | class Parent{ 2 | 3 | method getValue() returns int{ 4 | return 41 5 | } 6 | 7 | method getValueWithArg(int x) returns int{ 8 | return x * 10 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /tests/parent_method_calls/main.aspl: -------------------------------------------------------------------------------- 1 | var c = new Child() 2 | assert c.getValue() == 42 3 | assert c.getValueWithArg(3) == 35 -------------------------------------------------------------------------------- /tests/plusequals/plusequals.aspl: -------------------------------------------------------------------------------- 1 | var i = 1 2 | i += 5 3 | assert i == 6 4 | var s = "Hello" 5 | s += " World" 6 | assert s == "Hello World" -------------------------------------------------------------------------------- /tests/plusplus/plusplus.aspl: -------------------------------------------------------------------------------- 1 | var int i = 0 2 | i++ 3 | assert i == 1 4 | assert i++ == 2 -------------------------------------------------------------------------------- /tests/pointers/pointers.aspl: -------------------------------------------------------------------------------- 1 | var integer a = 0 2 | var int* p = &a 3 | print(p) 4 | assert *p == 0 -------------------------------------------------------------------------------- /tests/properties/properties.aspl: -------------------------------------------------------------------------------- 1 | print("Hello World!".length) -------------------------------------------------------------------------------- /tests/properties_without_constructor/Example.aspl: -------------------------------------------------------------------------------- 1 | class Example{ 2 | 3 | [public] 4 | property map m = {"Hello" => "World"} 5 | 6 | } -------------------------------------------------------------------------------- /tests/properties_without_constructor/main.aspl: -------------------------------------------------------------------------------- 1 | var e = new Example() 2 | assert e.m == {"Hello" => "World"} -------------------------------------------------------------------------------- /tests/repeat/repeat.aspl: -------------------------------------------------------------------------------- 1 | repeat(100, i = 0){ 2 | print(i) 3 | } 4 | 5 | var int amount = 10 6 | repeat(amount){ 7 | print("Hello") 8 | } -------------------------------------------------------------------------------- /tests/statics/Child.aspl: -------------------------------------------------------------------------------- 1 | [static] 2 | class Child extends Parent { 3 | 4 | [public] 5 | [static] 6 | property int first = 42 7 | 8 | [public] 9 | [static] 10 | method one(){ 11 | print("child: one") 12 | print("self: " + self:first) 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /tests/statics/Parent.aspl: -------------------------------------------------------------------------------- 1 | [static] 2 | class Parent { 3 | 4 | [public] 5 | [static] 6 | property int first = 42 7 | 8 | [public] 9 | [static] 10 | method one(){ 11 | print("parent: one") 12 | } 13 | 14 | [public] 15 | [static] 16 | method two(){ 17 | print("parent: two") 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /tests/statics/main.aspl: -------------------------------------------------------------------------------- 1 | Child:one() 2 | assert Child:first == 42 3 | Child:first = 21 4 | assert Child:first == 21 5 | Parent:two() 6 | assert Parent:first == 42 7 | Parent:first = 21 8 | assert Parent:first == 21 -------------------------------------------------------------------------------- /tests/unicode/unicode.aspl: -------------------------------------------------------------------------------- 1 | print("--- Hello World in different languages ---") 2 | print("Russian: Привет мир!") 3 | print("Ukrainian: Привіт світ!") 4 | print("Polish: Witaj świecie!") 5 | print("Chinese: 你好世界!") 6 | print("Japanese: こんにちは世界!") 7 | print("Korean: 안녕 세상!") 8 | print("Emoji: 👋🌍") 9 | 10 | assert "\u000a" == "\n" 11 | assert "\uc548" == "안" 12 | assert "\uc0c1" == "상" -------------------------------------------------------------------------------- /tests/variables/variables.aspl: -------------------------------------------------------------------------------- 1 | var string a = "Hello" 2 | var b = "World!" 3 | var string|null c = "World" 4 | c = b 5 | print(a) 6 | print(b) 7 | print(c) -------------------------------------------------------------------------------- /tests/while/while.aspl: -------------------------------------------------------------------------------- 1 | var int i = 0 2 | while(i != 100){ 3 | print(i) 4 | i++ 5 | } 6 | while(false){ 7 | assert false 8 | } -------------------------------------------------------------------------------- /thirdparty/appbundle/README.md: -------------------------------------------------------------------------------- 1 | # AppBundle 2 | This is an implementation of https://github.com/Wertzui123/AppBundle translated to C. 3 | 4 | ## License 5 | MIT License 6 | 7 | Copyright (c) 2024 Wertzui123 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in all 17 | copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. -------------------------------------------------------------------------------- /thirdparty/appbundle/loader.h: -------------------------------------------------------------------------------- 1 | #ifndef APPBUNDLE_MALLOC 2 | #define APPBUNDLE_MALLOC malloc 3 | #define STDLIB_INCLUDED 4 | #endif 5 | #ifndef APPBUNDLE_REALLOC 6 | #define APPBUNDLE_REALLOC realloc 7 | #define STDLIB_INCLUDED 8 | #endif 9 | #ifndef APPBUNDLE_FREE 10 | #define APPBUNDLE_FREE free 11 | #define STDLIB_INCLUDED 12 | #endif 13 | #ifdef STDLIB_INCLUDED 14 | #include 15 | #endif 16 | #ifndef APPBUNDLE_ERROR 17 | #include 18 | #define APPBUNDLE_ERROR(...) { fprintf(stderr, __VA_ARGS__); exit(1); } 19 | #endif 20 | 21 | typedef struct appbundle_Resource { 22 | char* name; 23 | void* data; 24 | unsigned int length; 25 | } appbundle_Resource; 26 | 27 | typedef struct appbundle_Bundle { 28 | appbundle_Resource* resources; 29 | unsigned int resources_length; 30 | } appbundle_Bundle; 31 | 32 | char appbundle_Bundle_contains_resource(appbundle_Bundle* bundle, char* name); 33 | appbundle_Resource appbundle_Bundle_get_resource(appbundle_Bundle* bundle, char* name); 34 | appbundle_Bundle* appbundle_Bundle_load(); -------------------------------------------------------------------------------- /thirdparty/cwsc/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Wertzui123 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /thirdparty/cwsc/README.md: -------------------------------------------------------------------------------- 1 | # C WebSocket Client (CWSC) 2 | A bare but useful single-file WebSocket client library written in C. 3 | 4 | This implementation is very roughly based on [boomanaiden154's WebSocket library](https://github.com/boomanaiden154/websocket) as well as the [`net.websocket`](https://github.com/vlang/v/tree/master/vlib/net/websocket) module of the V standard library. 5 | 6 | Moreover, it uses [TLSe](https://github.com/eduardsui/tlse) for TLS (previously known as SSL) support. 7 | 8 | ## License 9 | This project is licensed under the [MIT License](LICENSE). -------------------------------------------------------------------------------- /thirdparty/echttp/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Wertzui123 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /thirdparty/echttp/README.md: -------------------------------------------------------------------------------- 1 | # ECHTTP 2 | ECHTTP (pronounced somewhat like "easy HTTP" I'd say) is a simple single-file HTTP/HTTPS client library written in C. 3 | 4 | This implementation is roughly based on [http.h by Mattias Gustavsson](https://github.com/mattiasgustavsson/libs/blob/main/http.h), but has been refactored and improved, including **TLS support**, **more than just GET and POST requests**, and an **easier API**. 5 | 6 | It uses [TLSe](https://github.com/eduardsui/tlse) for TLS (previously known as SSL) support. 7 | 8 | ## License 9 | This project is licensed under the [MIT License](LICENSE). -------------------------------------------------------------------------------- /thirdparty/hashmap/README.md: -------------------------------------------------------------------------------- 1 | # HashMap 2 | This is an implementation of https://github.com/Wertzui123/HashMap translated to C. 3 | 4 | ## License 5 | MIT License 6 | 7 | Copyright (c) 2022 Wertzui123 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in all 17 | copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. -------------------------------------------------------------------------------- /thirdparty/icylib/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | *.exe 3 | *.png 4 | !examples/*/*.png 5 | -------------------------------------------------------------------------------- /thirdparty/icylib/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Wertzui123 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /thirdparty/icylib/color.h: -------------------------------------------------------------------------------- 1 | #ifndef ICYLIB_COLOR_H 2 | #define ICYLIB_COLOR_H 3 | 4 | #include "icylib.h" 5 | 6 | typedef struct icylib_Color { 7 | unsigned char r; 8 | unsigned char g; 9 | unsigned char b; 10 | unsigned char a; 11 | } icylib_Color; 12 | 13 | icylib_Color icylib_color_from_rgb(unsigned char r, unsigned char g, unsigned char b); 14 | icylib_Color icylib_color_from_rgba(unsigned char r, unsigned char g, unsigned char b, unsigned char a); 15 | 16 | #ifdef ICYLIB_IMPLEMENTATION 17 | 18 | icylib_Color icylib_color_from_rgb(unsigned char r, unsigned char g, unsigned char b) { 19 | icylib_Color color; 20 | color.r = r; 21 | color.g = g; 22 | color.b = b; 23 | color.a = 255; 24 | return color; 25 | } 26 | 27 | icylib_Color icylib_color_from_rgba(unsigned char r, unsigned char g, unsigned char b, unsigned char a) { 28 | icylib_Color color; 29 | color.r = r; 30 | color.g = g; 31 | color.b = b; 32 | color.a = a; 33 | return color; 34 | } 35 | 36 | #endif 37 | 38 | #endif -------------------------------------------------------------------------------- /thirdparty/icylib/examples/julia/julia.c: -------------------------------------------------------------------------------- 1 | #define ICYLIB_IMPLEMENTATION 2 | 3 | #include "regular_image.h" 4 | #include "color.h" 5 | 6 | void main() { 7 | icylib_RegularImage* image = icylib_regular_create_from_size(800, 800, 3); 8 | 9 | for (int y = 0; y < image->height; y++) { 10 | for (int x = 0; x < image->width; x++) { 11 | double a = (double)x / image->width * 4 - 2; 12 | double b = (double)y / image->height * 4 - 2; 13 | double ca = -0.8; 14 | double cb = 0.156; 15 | int n = 0; 16 | while (n < 100) { 17 | double aa = a * a - b * b; 18 | double bb = 2 * a * b; 19 | a = aa + ca; 20 | b = bb + cb; 21 | if (a * a + b * b > 16) { 22 | break; 23 | } 24 | n++; 25 | } 26 | icylib_Color color = icylib_color_from_rgb(0, 0, 0); 27 | if (n < 100) { 28 | color = icylib_color_from_rgb(255 * n / 100, 255 * n / 100, 255 * n / 100); 29 | } 30 | icylib_regular_set_pixel(image, x, y, color); 31 | } 32 | } 33 | 34 | icylib_regular_save_to_file(image, "julia_set.png"); 35 | } -------------------------------------------------------------------------------- /thirdparty/icylib/examples/julia/julia_set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspl-lang/aspl/e37b19f1387ba2531dc6ab8a603f5e6ad6eace0e/thirdparty/icylib/examples/julia/julia_set.png -------------------------------------------------------------------------------- /thirdparty/icylib/examples/shapes/shapes.c: -------------------------------------------------------------------------------- 1 | #define ICYLIB_IMPLEMENTATION 2 | 3 | #include "regular_image.h" 4 | #include "color.h" 5 | 6 | void main() { 7 | icylib_RegularImage* image = icylib_regular_create_from_size(500, 500, 4); 8 | 9 | icylib_regular_fill_rectangle(image, 100, 100, 400, 400, icylib_color_from_rgb(128, 64, 32), 0); 10 | icylib_regular_draw_rectangle(image, 150, 150, 350, 350, icylib_color_from_rgb(32, 64, 128), 0); 11 | icylib_regular_fill_circle(image, 250, 250, 100, icylib_color_from_rgb(128, 64, 128), 0); 12 | icylib_regular_draw_circle(image, 250, 250, 200, icylib_color_from_rgb(32, 64, 32), 0); 13 | 14 | icylib_regular_save_to_file(image, "shapes.png"); 15 | } -------------------------------------------------------------------------------- /thirdparty/icylib/examples/shapes/shapes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspl-lang/aspl/e37b19f1387ba2531dc6ab8a603f5e6ad6eace0e/thirdparty/icylib/examples/shapes/shapes.png -------------------------------------------------------------------------------- /thirdparty/icylib/examples/text/text.c: -------------------------------------------------------------------------------- 1 | #define ICYLIB_IMPLEMENTATION 2 | 3 | #include "regular_image.h" 4 | #include "color.h" 5 | 6 | void main() { 7 | icylib_RegularImage* image = icylib_regular_create_from_size(500, 500, 4); 8 | 9 | icylib_regular_draw_text(image, "Left aligned", 250, 125, icylib_color_from_rgb(255, 0, 0), icylib_get_default_font_path(), 30, ICYLIB_HORIZONTAL_ALIGNMENT_LEFT, ICYLIB_VERTICAL_ALIGNMENT_CENTER, 1); 10 | icylib_regular_draw_text(image, "Middle aligned", 250, 250, icylib_color_from_rgb(0, 255, 0), icylib_get_default_font_path(), 40, ICYLIB_HORIZONTAL_ALIGNMENT_CENTER, ICYLIB_VERTICAL_ALIGNMENT_CENTER, 1); 11 | icylib_regular_draw_text(image, "Middle aligned", 250, 375, icylib_color_from_rgb(0, 0, 255), icylib_get_default_font_path(), 30, ICYLIB_HORIZONTAL_ALIGNMENT_RIGHT, ICYLIB_VERTICAL_ALIGNMENT_CENTER, 1); 12 | 13 | icylib_regular_save_to_file(image, "text.png"); 14 | } -------------------------------------------------------------------------------- /thirdparty/icylib/examples/text/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspl-lang/aspl/e37b19f1387ba2531dc6ab8a603f5e6ad6eace0e/thirdparty/icylib/examples/text/text.png -------------------------------------------------------------------------------- /thirdparty/icylib/file_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef ICYLIB_FILE_UTILS_H 2 | #define ICYLIB_FILE_UTILS_H 3 | 4 | char icylib_file_exists(const char* path); 5 | size_t icylib_file_size(const char* path); 6 | char icylib_file_delete(const char* path); 7 | 8 | #ifdef ICYLIB_IMPLEMENTATION 9 | 10 | #ifdef _WIN32 11 | #include 12 | #else 13 | #include 14 | #endif 15 | #include 16 | 17 | char icylib_file_exists(const char* path) { 18 | #ifdef _WIN32 19 | return _access(path, 0) != -1; 20 | #else 21 | return access(path, F_OK) != -1; 22 | #endif 23 | } 24 | 25 | size_t icylib_file_size(const char* path) { 26 | FILE* file = fopen(path, "rb"); 27 | if (!file) { 28 | return 0; 29 | } 30 | fseek(file, 0, SEEK_END); 31 | size_t size = ftell(file); 32 | fclose(file); 33 | return size; 34 | } 35 | 36 | char icylib_file_delete(const char* path) { 37 | return remove(path) == 0; 38 | } 39 | 40 | #endif 41 | 42 | #endif -------------------------------------------------------------------------------- /thirdparty/icylib/math_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef ICYLIB_MATH_UTILS_H 2 | #define ICYLIB_MATH_UTILS_H 3 | 4 | int icylib_imin(int a, int b); 5 | 6 | int icylib_imax(int a, int b); 7 | 8 | int icylib_floor(double x); 9 | 10 | int icylib_ceil(double x); 11 | 12 | #ifdef ICYLIB_IMPLEMENTATION 13 | 14 | #include "icylib.h" 15 | 16 | int icylib_imin(int a, int b) { 17 | return a < b ? a : b; 18 | } 19 | 20 | int icylib_imax(int a, int b) { 21 | return a > b ? a : b; 22 | } 23 | 24 | int icylib_floor(double x) { 25 | return (int)x; 26 | } 27 | 28 | int icylib_ceil(double x) { 29 | return (int)x + 1; 30 | } 31 | 32 | #endif 33 | 34 | #endif -------------------------------------------------------------------------------- /thirdparty/libgc/.gitignore: -------------------------------------------------------------------------------- 1 | !* -------------------------------------------------------------------------------- /thirdparty/libgc/amalgamation.txt: -------------------------------------------------------------------------------- 1 | The libgc source is distributed here as an amalgamation (https://sqlite.org/amalgamation.html). 2 | This means that, rather than mirroring the entire bdwgc repo here, 3 | [this script](https://gist.github.com/spaceface777/34d25420f2dc4953fb7864f44a211105) was used 4 | to bundle all local includes together into a single C file, which is much easier to handle. 5 | Furthermore, the script above was also used to minify (i.e. remove comments and whitespace in) 6 | the garbage collector source. Together, these details help keep the V source distribution small, 7 | can reduce compile times by 3%-15%, and can help C compilers generate more optimized code. 8 | -------------------------------------------------------------------------------- /thirdparty/libgc/include/gc.h: -------------------------------------------------------------------------------- 1 | /* This file is installed for backward compatibility. */ 2 | #include "gc/gc.h" 3 | -------------------------------------------------------------------------------- /thirdparty/miniz/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013-2014 RAD Game Tools and Valve Software 2 | Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC 3 | 4 | All Rights Reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /thirdparty/netutils/README.md: -------------------------------------------------------------------------------- 1 | # Networking Utilities 2 | This folder contains a few useful networking utility files and functions used by the `internet` module. 3 | 4 | It is mostly responsible for a unified socket interface and implements TLS support using [TLSe](https://github.com/eduardsui/tlse). -------------------------------------------------------------------------------- /thirdparty/regexp/regexp.h: -------------------------------------------------------------------------------- 1 | #ifndef regexp_h 2 | #define regexp_h 3 | 4 | typedef struct Reprog Reprog; 5 | typedef struct Resub Resub; 6 | 7 | Reprog *regcomp(const char *pattern, int cflags, const char **errorp); 8 | int regexec(Reprog *prog, const char *string, Resub *sub, int eflags); 9 | void regfree(Reprog *prog); 10 | 11 | enum { 12 | /* regcomp flags */ 13 | REG_ICASE = 1, 14 | REG_NEWLINE = 2, 15 | 16 | /* regexec flags */ 17 | REG_NOTBOL = 4, 18 | 19 | /* limits */ 20 | REG_MAXSUB = 10 21 | }; 22 | 23 | struct Resub { 24 | unsigned int nsub; 25 | struct { 26 | const char *sp; 27 | const char *ep; 28 | } sub[REG_MAXSUB]; 29 | }; 30 | 31 | #endif -------------------------------------------------------------------------------- /thirdparty/sokol/.editorconfig: -------------------------------------------------------------------------------- 1 | root=true 2 | [**] 3 | indent_style=space 4 | indent_size=4 5 | trim_trailing_whitespace=true 6 | insert_final_newline=true 7 | 8 | [*.yml] 9 | indent_size=2 10 | -------------------------------------------------------------------------------- /thirdparty/sokol/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | build/ 3 | #>fips 4 | # this area is managed by fips, do not edit 5 | .fips-* 6 | *.pyc 7 | # REMINDER: we can pass `-fparse-all-comments` to the clang ast-dump command line which adds the following node types to the ast-dump.json: FullComment, ParagraphComment, TextComment. This might allow us to preserve comments in the language bindings (might be useful as part of a bigger change to make sokol header comments autodoc and Intellisense-friendly) 4 | 5 | ### Zig 6 | 7 | First make sure that clang and python3 are in the path: 8 | 9 | ``` 10 | > clang --version 11 | > python3 --version 12 | ``` 13 | 14 | ...on Windows I simply install those with scoop: 15 | 16 | ``` 17 | > scoop install llvm 18 | > scoop install python 19 | ``` 20 | 21 | To update the Zig bindings: 22 | 23 | ``` 24 | > cd sokol/bindgen 25 | > git clone https://github.com/floooh/sokol-zig 26 | > git clone https://github.com/floooh/sokol-nim 27 | > git clone https://github.com/floooh/sokol-odin 28 | > git clone https://github.com/floooh/sokol-rust 29 | > python3 gen_all.py 30 | ``` 31 | 32 | Test and run samples: 33 | 34 | ``` 35 | > cd sokol/bindgen/sokol-zig 36 | > zig build run-clear 37 | > zig build run-triangle 38 | > zig build run-cube 39 | ... 40 | ``` 41 | -------------------------------------------------------------------------------- /thirdparty/sokol/fips.yml: -------------------------------------------------------------------------------- 1 | exports: 2 | header-dirs: [ ".", "util" ] 3 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/analyze_ios.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | source test_common.sh 3 | build ios_gl_analyze ios_gl_analyze 4 | build ios_metal_analyze ios_metal_analyze 5 | build ios_arc_gl_analyze ios_arc_gl_analyze 6 | build ios_arc_metal_analyze ios_arc_metal_analyze 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/analyze_linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | source test_common.sh 4 | 5 | build linux_gl_analyze linux_gl_analyze 6 | build linux_gles3_analyze linux_gles3_analyze 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/analyze_macos.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | source test_common.sh 3 | 4 | build macos_gl_analyze macos_gl_analyze 5 | build macos_metal_analyze macos_metal_analyze 6 | 7 | build macos_arc_gl_analyze macos_arc_gl_analyze 8 | build macos_arc_metal_analyze macos_arc_metal_analyze 9 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/analyze_win.cmd: -------------------------------------------------------------------------------- 1 | cmake --preset win_gl_analyze || exit /b 10 2 | cmake --build --preset win_gl_analyze || exit /b 10 3 | cmake --preset win_d3d11_analyze || exit /b 10 4 | cmake --build --preset win_d3d11_analyze || exit /b 10 5 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_app.c: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_app.h" 3 | 4 | void use_app_impl(void) { 5 | sapp_run(&(sapp_desc){0}); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_app.cc: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_app.h" 3 | 4 | void use_app_impl() { 5 | sapp_run({ }); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_args.c: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_args.h" 3 | 4 | void use_args_impl(void) { 5 | sargs_setup(&(sargs_desc){0}); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_args.cc: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_args.h" 3 | 4 | void use_args_impl() { 5 | sargs_setup({}); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_audio.c: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_audio.h" 3 | 4 | void use_audio_impl(void) { 5 | saudio_setup(&(saudio_desc){0}); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_audio.cc: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_audio.h" 3 | 4 | void use_audio_impl() { 5 | saudio_setup({}); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_color.c: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "sokol_color.h" 4 | 5 | void use_color_impl(void) { 6 | sg_color c = sg_make_color_4b(255, 0, 0, 255); 7 | (void)c; 8 | } 9 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_color.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "sokol_color.h" 4 | 5 | void use_color_impl(void) { 6 | sg_color c = sg_make_color(255, 0, 0, 255); 7 | (void)c; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_debugtext.c: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "sokol_debugtext.h" 4 | 5 | void use_debugtext_impl(void) { 6 | sdtx_setup(&(sdtx_desc_t){0}); 7 | } 8 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_debugtext.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "sokol_debugtext.h" 4 | 5 | void use_debugtext_impl() { 6 | sdtx_setup({}); 7 | } 8 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_fetch.c: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_fetch.h" 3 | 4 | void use_fetch_impl(void) { 5 | sfetch_setup(&(sfetch_desc_t){0}); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_fetch.cc: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_fetch.h" 3 | 4 | void use_fetch_impl() { 5 | sfetch_setup({}); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_fontstash.c: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #include "sokol_gl.h" 3 | 4 | #define FONTSTASH_IMPLEMENTATION 5 | #if defined(_MSC_VER ) 6 | #pragma warning(disable:4996) // strncpy use in fontstash.h 7 | #endif 8 | #if defined(__GNUC__) || defined(__clang__) 9 | #pragma GCC diagnostic push 10 | #pragma GCC diagnostic ignored "-Wunused-function" 11 | #pragma GCC diagnostic ignored "-Wsign-conversion" 12 | #endif 13 | #include // malloc/free 14 | #include "fontstash.h" 15 | #define SOKOL_IMPL 16 | #include "sokol_fontstash.h" 17 | 18 | void use_fontstash_impl(void) { 19 | FONScontext* ctx = sfons_create(&(sfons_desc_t){ 0 }); 20 | sfons_destroy(ctx); 21 | } 22 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_fontstash.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #include "sokol_gl.h" 3 | 4 | #define FONTSTASH_IMPLEMENTATION 5 | #if defined(_MSC_VER ) 6 | #pragma warning(disable:4996) // strncpy use in fontstash.h 7 | #pragma warning(disable:4505) // unreferenced local function has been removed 8 | #pragma warning(disable:4100) // unreferenced formal parameter 9 | #endif 10 | #if defined(__GNUC__) || defined(__clang__) 11 | #pragma GCC diagnostic ignored "-Wunused-function" 12 | #pragma GCC diagnostic ignored "-Wsign-conversion" 13 | #endif 14 | #include // malloc/free 15 | #include "fontstash.h" 16 | #define SOKOL_IMPL 17 | #include "sokol_fontstash.h" 18 | 19 | void use_fontstash_impl() { 20 | const sfons_desc_t desc = { }; 21 | FONScontext* ctx = sfons_create(&desc); 22 | sfons_destroy(ctx); 23 | } 24 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_gfx.c: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_gfx.h" 3 | 4 | void use_gfx_impl(void) { 5 | sg_setup(&(sg_desc){0}); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_gfx.cc: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_gfx.h" 3 | 4 | void use_gfx_impl() { 5 | sg_setup({}); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_gfx_imgui.c: -------------------------------------------------------------------------------- 1 | #include "sokol_app.h" 2 | #include "sokol_gfx.h" 3 | #define CIMGUI_DEFINE_ENUMS_AND_STRUCTS 4 | #if defined(_MSC_VER ) 5 | #pragma warning(disable:4201) // nonstandard extension used: nameless struct/union 6 | #pragma warning(disable:4214) // nonstandard extension used: bit field types other than int 7 | #endif 8 | #include "cimgui/cimgui.h" 9 | #include "sokol_imgui.h" 10 | #define SOKOL_IMPL 11 | #include "sokol_gfx_imgui.h" 12 | 13 | void use_gfx_imgui_impl(void) { 14 | sgimgui_t ctx = {0}; 15 | sgimgui_init(&ctx, &(sgimgui_desc_t){0}); 16 | sgimgui_discard(&ctx); 17 | } 18 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_gfx_imgui.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_app.h" 2 | #include "sokol_gfx.h" 3 | #include "imgui.h" 4 | #include "sokol_imgui.h" 5 | #define SOKOL_IMPL 6 | #include "sokol_gfx_imgui.h" 7 | 8 | void use_gfx_imgui_impl() { 9 | sgimgui_t ctx = {}; 10 | sgimgui_init(&ctx, { }); 11 | sgimgui_discard(&ctx); 12 | } 13 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_gl.c: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "sokol_gl.h" 4 | 5 | void use_gl_impl(void) { 6 | sgl_setup(&(sgl_desc_t){0}); 7 | } 8 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_gl.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "sokol_gl.h" 4 | 5 | void use_gl_impl() { 6 | sgl_setup({}); 7 | } 8 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_glue.c: -------------------------------------------------------------------------------- 1 | #include "sokol_app.h" 2 | #include "sokol_gfx.h" 3 | #define SOKOL_IMPL 4 | #include "sokol_glue.h" 5 | 6 | void use_glue_impl(void) { 7 | const sg_environment env = sglue_environment(); 8 | (void)env; 9 | } 10 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_glue.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_app.h" 2 | #include "sokol_gfx.h" 3 | #define SOKOL_IMPL 4 | #include "sokol_glue.h" 5 | 6 | void use_glue_impl() { 7 | const sg_environment ctx = sglue_environment(); 8 | (void)ctx; 9 | } 10 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_imgui.c: -------------------------------------------------------------------------------- 1 | #include "sokol_app.h" 2 | #include "sokol_gfx.h" 3 | #define CIMGUI_DEFINE_ENUMS_AND_STRUCTS 4 | #if defined(_MSC_VER ) 5 | #pragma warning(disable:4201) // nonstandard extension used: nameless struct/union 6 | #pragma warning(disable:4214) // nonstandard extension used: bit field types other than int 7 | #endif 8 | #include "cimgui/cimgui.h" 9 | #define SOKOL_IMPL 10 | #if defined(SOKOL_DUMMY_BACKEND) 11 | #define SOKOL_IMGUI_NO_SOKOL_APP 12 | #endif 13 | #include "sokol_imgui.h" 14 | 15 | void use_imgui_impl(void) { 16 | simgui_setup(&(simgui_desc_t){0}); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_imgui.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_app.h" 2 | #include "sokol_gfx.h" 3 | #include "imgui.h" 4 | #define SOKOL_IMPL 5 | #if defined(SOKOL_DUMMY_BACKEND) 6 | #define SOKOL_IMGUI_NO_SOKOL_APP 7 | #endif 8 | #include "sokol_imgui.h" 9 | 10 | void use_imgui_impl() { 11 | simgui_setup({}); 12 | } 13 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_log.c: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_log.h" 3 | 4 | void use_sokol_log(void) { 5 | slog_func("bla", 1, 123, "123", 42, "bla.c", 0); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_log.cc: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_log.h" 3 | 4 | void use_sokol_log(void) { 5 | slog_func("bla", 1, 123, "123", 42, "bla.c", 0); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_main.c: -------------------------------------------------------------------------------- 1 | #include "sokol_app.h" 2 | 3 | #if defined(SOKOL_DUMMY_BACKEND) 4 | int main() { 5 | return 0; 6 | } 7 | #else 8 | sapp_desc sokol_main(int argc, char* argv[]) { 9 | (void)argc; 10 | (void)argv; 11 | return (sapp_desc){0}; 12 | } 13 | #endif 14 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_main.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_app.h" 2 | 3 | sapp_desc sokol_main(int argc, char* argv[]) { 4 | (void)argc; 5 | (void)argv; 6 | return { }; 7 | } 8 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_nuklear.c: -------------------------------------------------------------------------------- 1 | #include "sokol_app.h" 2 | #include "sokol_gfx.h" 3 | 4 | // include nuklear.h before the sokol_nuklear.h implementation 5 | #define NK_INCLUDE_FIXED_TYPES 6 | #define NK_INCLUDE_STANDARD_IO 7 | #define NK_INCLUDE_DEFAULT_ALLOCATOR 8 | #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT 9 | #define NK_INCLUDE_FONT_BAKING 10 | #define NK_INCLUDE_DEFAULT_FONT 11 | #define NK_INCLUDE_STANDARD_VARARGS 12 | #include "nuklear.h" 13 | 14 | #define SOKOL_IMPL 15 | #if defined(SOKOL_DUMMY_BACKEND) 16 | #define SOKOL_NUKLEAR_NO_SOKOL_APP 17 | #endif 18 | #include "sokol_nuklear.h" 19 | 20 | void use_nuklear_impl(void) { 21 | snk_setup(&(snk_desc_t){0}); 22 | } 23 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_shape.c: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "sokol_shape.h" 4 | 5 | void use_shape_impl(void) { 6 | sshape_plane_sizes(10); 7 | } 8 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_shape.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "sokol_shape.h" 4 | 5 | void use_shape_impl() { 6 | sshape_plane_sizes(10); 7 | } 8 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_spine.c: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "spine/spine.h" 4 | #include "sokol_spine.h" 5 | 6 | void use_sspine_impl(void) { 7 | sspine_setup(&(sspine_desc){0}); 8 | } 9 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_spine.cc: -------------------------------------------------------------------------------- 1 | #include "sokol_gfx.h" 2 | #define SOKOL_IMPL 3 | #include "spine/spine.h" 4 | #include "sokol_spine.h" 5 | 6 | void use_sspine_impl(void) { 7 | const sspine_desc desc = {}; 8 | sspine_setup(&desc); 9 | } 10 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_time.c: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_time.h" 3 | 4 | void use_time_impl(void) { 5 | stm_setup(); 6 | } 7 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/compile/sokol_time.cc: -------------------------------------------------------------------------------- 1 | #define SOKOL_IMPL 2 | #include "sokol_time.h" 3 | 4 | void use_time_impl() { 5 | stm_setup(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/ext/nuklear.c: -------------------------------------------------------------------------------- 1 | // include nuklear.h before the sokol_nuklear.h implementation 2 | #define NK_INCLUDE_FIXED_TYPES 3 | #define NK_INCLUDE_STANDARD_IO 4 | #define NK_INCLUDE_DEFAULT_ALLOCATOR 5 | #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT 6 | #define NK_INCLUDE_FONT_BAKING 7 | #define NK_INCLUDE_DEFAULT_FONT 8 | #define NK_INCLUDE_STANDARD_VARARGS 9 | #define NK_IMPLEMENTATION 10 | 11 | #if defined(__clang__) 12 | #pragma GCC diagnostic ignored "-Wunknown-warning-option" 13 | #pragma GCC diagnostic ignored "-Wunused-parameter" 14 | #pragma GCC diagnostic ignored "-Wsign-conversion" 15 | #pragma GCC diagnostic ignored "-Wnull-pointer-subtraction" 16 | #pragma GCC diagnostic ignored "-Wunused-but-set-variable" 17 | #endif 18 | #if defined(__GNUC__) && !defined(__clang__) 19 | #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" 20 | #pragma GCC diagnostic ignored "-Wsign-conversion" 21 | #pragma GCC diagnostic ignored "-Wunused-parameter" 22 | #endif 23 | #if defined(_MSC_VER) 24 | #pragma warning(push) 25 | #pragma warning(disable:4996) // sprintf,fopen,localtime: This function or variable may be unsafe 26 | #pragma warning(disable:4127) // conditional expression is constant 27 | #pragma warning(disable:4100) // unreferenced formal parameter 28 | #pragma warning(disable:4701) // potentially uninitialized local variable used 29 | #endif 30 | #include "nuklear.h" 31 | #if defined(_MSC_VER) 32 | #pragma warning(pop) 33 | #endif 34 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/functional/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT ANDROID) 2 | 3 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets/comsi.s3m DESTINATION ${CMAKE_BINARY_DIR}) 4 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets/comsi.s3m DESTINATION ${CMAKE_BINARY_DIR}/Debug) 5 | 6 | set(c_sources 7 | sokol_log_test.c 8 | sokol_args_test.c 9 | sokol_audio_test.c 10 | sokol_debugtext_test.c 11 | sokol_fetch_test.c 12 | sokol_gfx_test.c 13 | sokol_gl_test.c 14 | sokol_shape_test.c 15 | sokol_color_test.c 16 | sokol_spine_test.c 17 | sokol_test.c 18 | ) 19 | add_executable(sokol-test ${c_sources}) 20 | target_link_libraries(sokol-test PUBLIC spine) 21 | configure_c(sokol-test) 22 | 23 | endif() 24 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/functional/README.txt: -------------------------------------------------------------------------------- 1 | Test the public API behaviour with dummy backends. 2 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/functional/assets/comsi.s3m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspl-lang/aspl/e37b19f1387ba2531dc6ab8a603f5e6ad6eace0e/thirdparty/sokol/tests/functional/assets/comsi.s3m -------------------------------------------------------------------------------- /thirdparty/sokol/tests/functional/assets/readme.txt: -------------------------------------------------------------------------------- 1 | Spine examples taken from: 2 | 3 | https://github.com/EsotericSoftware/spine-runtimes/tree/4.1/examples 4 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/functional/force_dummy_backend.h: -------------------------------------------------------------------------------- 1 | #if defined(SOKOL_GLES3) 2 | #undef SOKOL_GLES3 3 | #endif 4 | #if defined(SOKOL_GLCORE) 5 | #undef SOKOL_GLCORE 6 | #endif 7 | #if defined(SOKOL_METAL) 8 | #undef SOKOL_METAL 9 | #endif 10 | #if defined(SOKOL_D3D11) 11 | #undef SOKOL_D3D11 12 | #endif 13 | #if defined(SOKOL_WGPU) 14 | #undef SOKOL_WGPU 15 | #endif 16 | #ifndef SOKOL_DUMMY_BACKEND 17 | #define SOKOL_DUMMY_BACKEND 18 | #endif 19 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/functional/sokol_log_test.c: -------------------------------------------------------------------------------- 1 | #define SOKOL_LOG_IMPL 2 | #include "sokol_log.h" 3 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/functional/sokol_test.c: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // sokol-test.c 3 | // Sokol headers main test source. 4 | //------------------------------------------------------------------------------ 5 | #include "utest.h" 6 | 7 | UTEST_MAIN(); 8 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/test_android.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | source test_common.sh 4 | setup_android 5 | build android_debug android_debug 6 | build android_release android_release 7 | build android_sles_debug android_sles_debug 8 | build android_sles_release android_sles_release 9 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/test_emscripten.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | source test_common.sh 4 | setup_emsdk 5 | build emsc_webgl2_debug emsc_webgl2_debug 6 | build emsc_webgl2_release emsc_webgl2_release 7 | build emsc_wgpu_debug emsc_wgpu_debug 8 | build emsc_wgpu_release emsc_wgpu_release 9 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/test_ios.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | source test_common.sh 3 | build ios_gl ios_gl_debug 4 | build ios_gl ios_gl_release 5 | build ios_metal ios_metal_debug 6 | build ios_metal ios_metal_release 7 | build ios_arc_gl ios_arc_gl_debug 8 | build ios_arc_gl ios_arc_gl_release 9 | build ios_arc_metal ios_arc_metal_debug 10 | build ios_arc_metal ios_arc_metal_release 11 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/test_linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | source test_common.sh 4 | build linux_gl_debug linux_gl_debug 5 | build linux_gl_release linux_gl_release 6 | build linux_gles3_debug linux_gles3_debug 7 | build linux_gles3_release linux_gles3_release 8 | build linux_gl_egl_debug linux_gl_egl_debug 9 | build linux_gl_egl_release linux_gl_egl_release 10 | runtest linux_gl_debug 11 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/test_macos.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | source test_common.sh 3 | build macos_gl_debug macos_gl_debug 4 | build macos_gl_release macos_gl_release 5 | build macos_metal_debug macos_metal_debug 6 | build macos_metal_release macos_metal_release 7 | build macos_arc_gl_debug macos_arc_gl_debug 8 | build macos_arc_gl_release macos_arc_gl_release 9 | build macos_arc_metal_debug macos_arc_metal_debug 10 | build macos_arc_metal_release macos_arc_metal_release 11 | runtest macos_gl_debug 12 | -------------------------------------------------------------------------------- /thirdparty/sokol/tests/test_win.cmd: -------------------------------------------------------------------------------- 1 | cmake --preset win_gl || exit /b 10 2 | cmake --build --preset win_gl_debug || exit /b 10 3 | cmake --build --preset win_gl_release || exit /b 10 4 | 5 | cmake --preset win_d3d11 || exit /b 10 6 | cmake --build --preset win_d3d11_debug || exit /b 10 7 | cmake --build --preset win_d3d11_release || exit /b 10 8 | 9 | cd build\win_d3d11\Debug 10 | sokol-test.exe || exit /b 10 11 | cd ..\..\.. 12 | -------------------------------------------------------------------------------- /thirdparty/ssl/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Wertzui123 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /thirdparty/ssl/README.md: -------------------------------------------------------------------------------- 1 | # Sokol Static Library 2 | This is what makes cross-compilation of graphical applications with the C backend possible in ASPL. 3 | 4 | TODO: Add more documentation -------------------------------------------------------------------------------- /thirdparty/ssl/linux/bin/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspl-lang/aspl/e37b19f1387ba2531dc6ab8a603f5e6ad6eace0e/thirdparty/ssl/linux/bin/libssl.a -------------------------------------------------------------------------------- /thirdparty/ssl/linux/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # TODO: Find a more robust way to prevent sokol from including the OpenGL headers 3 | SOKOL_PATH="../../../thirdparty/sokol/" 4 | if ! grep -q '//#include ' "${SOKOL_PATH}sokol_app.h"; then 5 | sed -i 's|#include |//&|' "${SOKOL_PATH}sokol_app.h" 6 | sed -i 's|typedef struct __GLXFBConfig\* GLXFBConfig;|/*&|' "${SOKOL_PATH}sokol_app.h" 7 | sed -i 's|typedef GLXContext (\*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display\*,GLXFBConfig,GLXContext,Bool,const int\*);|&*/|' "${SOKOL_PATH}sokol_app.h" 8 | fi 9 | if ! grep -q '//#include ' "${SOKOL_PATH}sokol_gfx.h"; then 10 | sed -i 's|#include |//&|' "${SOKOL_PATH}sokol_gfx.h" 11 | fi 12 | zig cc -o bin/ssl.o -c ssl.c -DSOKOL_NO_ENTRY -O3 13 | zig ar rcs bin/libssl.a bin/ssl.o 14 | rm bin/ssl.o -------------------------------------------------------------------------------- /thirdparty/ssl/linux/glbind_dummies.c: -------------------------------------------------------------------------------- 1 | #define GLBIND_IMPLEMENTATION 2 | #include "../glbind.h" 3 | 4 | #include 5 | #include 6 | 7 | #define SSL_ERROR_CB(...) { printf("SSL Error: "); printf(__VA_ARGS__); printf("\n"); exit(1); } 8 | 9 | void ssl_init_glbind(){ 10 | GLenum result = glbInit(NULL, NULL); 11 | if (result != GL_NO_ERROR) { 12 | SSL_ERROR_CB("Failed to initialize glbind: %d\n", result); 13 | } 14 | } -------------------------------------------------------------------------------- /thirdparty/ssl/linux/ssl.c: -------------------------------------------------------------------------------- 1 | #include "x11_dummies.c" 2 | #include "glbind_dummies.c" 3 | 4 | #define SOKOL_APP_IMPL 5 | #define SOKOL_GLCORE 6 | #include "../../../thirdparty/sokol/sokol_app.h" 7 | #define SOKOL_LOG_IMPL 8 | #include "../../../thirdparty/sokol/sokol_log.h" 9 | #define SOKOL_GFX_IMPL 10 | #include "../../../thirdparty/sokol/sokol_gfx.h" 11 | #define SOKOL_GLUE_IMPL 12 | #include "../../../thirdparty/sokol/sokol_glue.h" 13 | #define SOKOL_GL_IMPL 14 | #include "../../../thirdparty/sokol/util/sokol_gl.h" 15 | 16 | void ssl_init(){ 17 | ssl_init_x11(); 18 | ssl_init_glbind(); 19 | } -------------------------------------------------------------------------------- /thirdparty/ssl/linux/ssl.h: -------------------------------------------------------------------------------- 1 | void ssl_init(); -------------------------------------------------------------------------------- /thirdparty/thread.h/README.md: -------------------------------------------------------------------------------- 1 | # thread.h 2 | A simple header-only library for cross-plattform multithreading in C: https://github.com/mattiasgustavsson/libs/blob/main/thread.h 3 | 4 | ## License 5 | MIT License 6 | 7 | Copyright (c) 2015 Mattias Gustavsson 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of 10 | this software and associated documentation files (the "Software"), to deal in 11 | the Software without restriction, including without limitation the rights to 12 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 13 | of the Software, and to permit persons to whom the Software is furnished to do 14 | so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in all 17 | copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. --------------------------------------------------------------------------------