├── .gitignore ├── .prettierignore ├── .prettierrc ├── README.md ├── languages ├── Eia64 │ ├── .gitignore │ ├── .idea │ │ ├── .gitignore │ │ ├── .name │ │ ├── artifacts │ │ │ └── Eia64_main_jar.xml │ │ ├── gradle.xml │ │ ├── inspectionProfiles │ │ │ └── Project_Default.xml │ │ ├── kotlinc.xml │ │ ├── misc.xml │ │ ├── uiDesigner.xml │ │ └── vcs.xml │ ├── Eia64.jar │ ├── LICENSE │ ├── README.md │ ├── build.gradle.kts │ ├── examples │ │ ├── BinarySearch.eia │ │ ├── LevenshteinDistance.eia │ │ ├── MathInterpreter.eia │ │ ├── MathSteps.eia │ │ ├── README.md │ │ ├── RockPaperScissor.eia │ │ ├── animation.eia │ │ ├── math_interpreterv2.eia │ │ └── superfib.eia │ ├── good.gif │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── graphics │ │ ├── interactive_shell.png │ │ └── nest_shell.png │ ├── pipes.txt │ ├── promo.cast │ ├── promo.gif │ ├── settings.gradle.kts │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── space │ │ │ │ └── themelon │ │ │ │ └── eia64 │ │ │ │ ├── CompletionHelper.kt │ │ │ │ ├── DevStart.java │ │ │ │ ├── Eia.kt │ │ │ │ ├── EiaLive.kt │ │ │ │ ├── EiaTrace.kt │ │ │ │ ├── Expression.kt │ │ │ │ ├── Main.kt │ │ │ │ ├── TerminalColors.kt │ │ │ │ ├── analysis │ │ │ │ ├── FunctionReference.kt │ │ │ │ ├── ModuleInfo.kt │ │ │ │ ├── ParserX.kt │ │ │ │ ├── ResolutionScope.kt │ │ │ │ ├── ScopeManager.kt │ │ │ │ ├── TestModule.java │ │ │ │ ├── UniqueFunction.kt │ │ │ │ ├── UniqueVariable.kt │ │ │ │ └── VariableReference.kt │ │ │ │ ├── expressions │ │ │ │ ├── Alpha.kt │ │ │ │ ├── ArrayAccess.kt │ │ │ │ ├── ArrayAllocation.kt │ │ │ │ ├── ArrayLiteral.kt │ │ │ │ ├── AutoVariable.kt │ │ │ │ ├── BinaryOperation.kt │ │ │ │ ├── BoolLiteral.kt │ │ │ │ ├── Cast.kt │ │ │ │ ├── CharLiteral.kt │ │ │ │ ├── ClassMethodCall.kt │ │ │ │ ├── ExplicitArrayLiteral.kt │ │ │ │ ├── ExplicitVariable.kt │ │ │ │ ├── ExpressionList.kt │ │ │ │ ├── FloatLiteral.kt │ │ │ │ ├── ForEach.kt │ │ │ │ ├── ForLoop.kt │ │ │ │ ├── ForeignField.kt │ │ │ │ ├── FunctionExpr.kt │ │ │ │ ├── IfStatement.kt │ │ │ │ ├── Include.kt │ │ │ │ ├── IntLiteral.kt │ │ │ │ ├── Interruption.kt │ │ │ │ ├── IsStatement.kt │ │ │ │ ├── Itr.kt │ │ │ │ ├── MethodCall.kt │ │ │ │ ├── NativeCall.kt │ │ │ │ ├── NewObj.kt │ │ │ │ ├── NilLiteral.kt │ │ │ │ ├── NoneExpression.kt │ │ │ │ ├── Scope.kt │ │ │ │ ├── ShadoInvoke.kt │ │ │ │ ├── Shadow.kt │ │ │ │ ├── StringLiteral.kt │ │ │ │ ├── ThrowExpr.kt │ │ │ │ ├── TryCatch.kt │ │ │ │ ├── TypeLiteral.kt │ │ │ │ ├── UnaryOperation.kt │ │ │ │ ├── Until.kt │ │ │ │ └── When.kt │ │ │ │ ├── primitives │ │ │ │ ├── ArrayOperable.kt │ │ │ │ ├── EArray.kt │ │ │ │ ├── EBool.kt │ │ │ │ ├── EChar.kt │ │ │ │ ├── EFloat.kt │ │ │ │ ├── EInt.kt │ │ │ │ ├── ENil.kt │ │ │ │ ├── EString.kt │ │ │ │ ├── EType.kt │ │ │ │ ├── Numeric.kt │ │ │ │ └── Primitive.kt │ │ │ │ ├── runtime │ │ │ │ ├── EiaRuntimeException.kt │ │ │ │ ├── Entity.kt │ │ │ │ ├── Evaluator.kt │ │ │ │ ├── Executor.kt │ │ │ │ ├── InterruptionType.kt │ │ │ │ ├── Memory.kt │ │ │ │ ├── Nothing.kt │ │ │ │ ├── ShutdownException.kt │ │ │ │ └── VoidEvaluator.kt │ │ │ │ ├── signatures │ │ │ │ ├── ArrayExtension.kt │ │ │ │ ├── Matching.kt │ │ │ │ ├── ObjectExtension.kt │ │ │ │ ├── Sign.kt │ │ │ │ ├── Signature.kt │ │ │ │ └── SimpleSignature.kt │ │ │ │ └── syntax │ │ │ │ ├── Flag.kt │ │ │ │ ├── Lexer.kt │ │ │ │ ├── StaticToken.kt │ │ │ │ ├── Token.kt │ │ │ │ └── Type.kt │ │ │ └── resources │ │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ │ ├── animation.eia │ │ │ ├── benchmarking.eia │ │ │ ├── breakittest.eia │ │ │ ├── bubblesort.eia │ │ │ ├── classimportests.eia │ │ │ ├── classplan.eia │ │ │ ├── compoundoperators.eia │ │ │ ├── crashparser.eia │ │ │ ├── demo.eia │ │ │ ├── dynamicload.eia │ │ │ ├── fixtest.eia │ │ │ ├── flowcheck.eia │ │ │ ├── fnHello.eia │ │ │ ├── hello.eia │ │ │ ├── invoketest.eia │ │ │ ├── kitabreaktest.eia │ │ │ ├── listdeclarationtest.eia │ │ │ ├── looping.eia │ │ │ ├── loops.eia │ │ │ ├── looptesting.eia │ │ │ ├── miw.eia │ │ │ ├── preparesetest │ │ │ └── verify.eia │ │ │ ├── randomizationtest.eia │ │ │ ├── stdlibtest.eia │ │ │ ├── stringclazz.eia │ │ │ ├── strings.eia │ │ │ ├── trytobreak.eia │ │ │ ├── types.eia │ │ │ ├── usesymbol.eia │ │ │ ├── whenstatements.eia │ │ │ └── wraptest.eia │ ├── stdlib │ │ ├── README.md │ │ ├── array.eia │ │ ├── eint.eia │ │ ├── etype.eia │ │ ├── list.eia │ │ ├── math.eia │ │ └── string.eia │ ├── testfiles │ │ ├── imaginations │ │ │ ├── AccessingPerson.eia │ │ │ ├── HelloWorld.eia │ │ │ ├── Person.eia │ │ │ ├── arrayexpectation.eia │ │ │ ├── doublebypasscheck.eia │ │ │ ├── dualreferencing.eia │ │ │ ├── fnsignaturebypass.eia │ │ │ ├── loadtest.eia │ │ │ ├── overload.eia │ │ │ ├── plan.jpg │ │ │ ├── simplifiedaccess.eia │ │ │ ├── someretestingofsyntax │ │ │ ├── trickyfloatparse.eia │ │ │ └── trycatchtesting.eia │ │ ├── simulationenv │ │ │ ├── Boww.eia │ │ │ ├── Cat.eia │ │ │ ├── DependencyA.eia │ │ │ ├── DiamondCast │ │ │ ├── ExampleClass.eia │ │ │ ├── ExtentiveObj.eia │ │ │ ├── ExternalA.eia │ │ │ ├── Girl.eia │ │ │ ├── Man.eia │ │ │ ├── Module.eia │ │ │ ├── Need.eia │ │ │ ├── NullA.eia │ │ │ ├── NullB.eia │ │ │ ├── ObjectExample.eia │ │ │ ├── One.eia │ │ │ ├── Person.eia │ │ │ ├── PersonDetails.eia │ │ │ ├── SimpleA.eia │ │ │ ├── SimpleB.eia │ │ │ ├── SimpleElement.eia │ │ │ ├── SimpleObject.eia │ │ │ ├── ValueClass.eia │ │ │ ├── anytoonecast.eia │ │ │ ├── arraydecltests.eia │ │ │ ├── arrayparametertesting.eia │ │ │ ├── arrayreferencetest.eia │ │ │ ├── arraysigbreak.eia │ │ │ ├── autoint.eia │ │ │ ├── bodysigntest.eia │ │ │ ├── breakingsyntax.eia │ │ │ ├── comparisionsupport.eia │ │ │ ├── converioncheck.eia │ │ │ ├── debugstringlex.eia │ │ │ ├── declarativematch.eia │ │ │ ├── deflattentest.eia │ │ │ ├── diamongparsing.eia │ │ │ ├── dynamicarrayclasstest.eia │ │ │ ├── dynamicobjfalsecast.eia │ │ │ ├── exacttypetest.eia │ │ │ ├── extensiontoprimitiveobj.eia │ │ │ ├── fakecasttest.eia │ │ │ ├── falseobjextension.eia │ │ │ ├── fnargverification.eia │ │ │ ├── fncustomarg.eia │ │ │ ├── fnsignaturematch.eia │ │ │ ├── fnvoidtest.eia │ │ │ ├── functionoverloadingbehaviour.eia │ │ │ ├── functionselfreferencingtest.eia │ │ │ ├── hello.eia │ │ │ ├── ifimagination.eia │ │ │ ├── ifsimulate.eia │ │ │ ├── importedcasting.eia │ │ │ ├── includetest.eia │ │ │ ├── interruptflowcheck.eia │ │ │ ├── interruptioncheck.eia │ │ │ ├── intparsetest.eia │ │ │ ├── istesting.eia │ │ │ ├── lexertest.eia │ │ │ ├── listtest.eia │ │ │ ├── loopcheck.eia │ │ │ ├── nestedreturnstmttesting.eia │ │ │ ├── newarraytesting.eia │ │ │ ├── objcast.eia │ │ │ ├── objectarraytesting.eia │ │ │ ├── objectcreationbenchmark.eia │ │ │ ├── objparmmismatchtest.eia │ │ │ ├── operationtesting.eia │ │ │ ├── otherflowtest.eia │ │ │ ├── overclasstest.eia │ │ │ ├── propertyaccess.eia │ │ │ ├── provoke.eia │ │ │ ├── recursiontesting.eia │ │ │ ├── recursiveflowtest.eia │ │ │ ├── replicatereproducemathsolver.eia │ │ │ ├── returnmetatesting.eia │ │ │ ├── secondfunctionoverloadingtest.eia │ │ │ ├── secondobjarrtest.eia │ │ │ ├── secondsignaturefullfilltest.eia │ │ │ ├── secondsimulation.eia │ │ │ ├── shadoargs.eia │ │ │ ├── signaturefullfilltest.eia │ │ │ ├── simpleimport.eia │ │ │ ├── standardizingforloop.eia │ │ │ ├── stringincltest.eia │ │ │ ├── terminativeflowcheck.eia │ │ │ ├── terminativeiftesting.eia │ │ │ ├── test.eia │ │ │ ├── test2.eia │ │ │ ├── trimmetest.eia │ │ │ ├── unitexprtesting.eia │ │ │ ├── valuevariableaccess.eia │ │ │ └── voidarraytest.eia │ │ └── stdlibtest │ │ │ ├── Secondary.eia │ │ │ ├── aFloat.eia │ │ │ ├── additionalstringtest.eia │ │ │ ├── advanced_recursion_test.eia │ │ │ ├── arraytest.eia │ │ │ ├── bool_parse_investigation.eia │ │ │ ├── bugtest.eia │ │ │ ├── classimagination.eia │ │ │ ├── einttest.eia │ │ │ ├── explorationreview.eia │ │ │ ├── inttest.eia │ │ │ ├── isolatedandtesting.eia │ │ │ ├── listscheck.eia │ │ │ ├── listtest.eia │ │ │ ├── mathtest.eia │ │ │ ├── numericchecktest.eia │ │ │ ├── numericsyntaxtest.eia │ │ │ ├── parseordertest.eia │ │ │ ├── queuetesting.eia │ │ │ ├── recreaterps.eia │ │ │ ├── secondfloat.eia │ │ │ ├── simulate_parse_break.eia │ │ │ ├── stringtest.eia │ │ │ ├── testmodule.eia │ │ │ ├── typetest.eia │ │ │ ├── unittest.eia │ │ │ └── when_expression_test │ ├── tests │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── space │ │ │ └── themelon │ │ │ └── eia64 │ │ │ ├── EiaLiveAlternative.kt │ │ │ └── Main.java │ └── vision │ │ ├── ClassicPerson.eia │ │ ├── Meow.eia │ │ ├── Person.eia │ │ ├── SimpleDeclaration.eia │ │ ├── additivefloat.eia │ │ ├── arraycasttest.eia │ │ ├── arraydistinguishproblem.eia │ │ ├── basictesting.eia │ │ ├── binaryfloattest.eia │ │ ├── casttesting.eia │ │ ├── directarrraytest.eia │ │ ├── floatest.eia │ │ ├── floatinverse.eia │ │ ├── foatcomparision.eia │ │ ├── foreignfieldmodification.eia │ │ ├── functionorder.eia │ │ ├── imaginenil.eia │ │ ├── isstatementtest.eia │ │ ├── maptest.eia │ │ ├── modifiersimagination.eia │ │ ├── modifiertesting.eia │ │ ├── mutabilityparsetest.eia │ │ ├── niltest.eia │ │ ├── numberwrapping.eia │ │ ├── prematchblind.eia │ │ ├── primitiveobjtoextensionsign.eia │ │ ├── primitivetoextensionsign.eia │ │ ├── secondniltest.eia │ │ ├── simplearith.eia │ │ ├── simpleruns.eia │ │ └── trickyfloats.eia ├── arson │ ├── .gitignore │ ├── README.md │ ├── aast.py │ ├── abuiltins.py │ ├── aeval.py │ ├── alexer.py │ ├── aparser.py │ ├── arson.py │ └── examples │ │ ├── others │ │ ├── fibonacci.ars │ │ ├── guess-the-number.ars │ │ └── sudoku-solver.ars │ │ └── readme │ │ └── example.ars ├── easel │ ├── .gitignore │ ├── README.md │ ├── ast.js │ ├── easel.js │ ├── examples │ │ ├── cli.js │ │ ├── colors.easel │ │ ├── gol.easel │ │ └── whoami.easel │ ├── index.html │ ├── interpreter.js │ ├── lexer.js │ ├── parser.js │ └── stdlib.js ├── fateful │ ├── .gitignore │ ├── Arch.md │ ├── Cargo.lock │ ├── Cargo.toml │ ├── LICENCE │ ├── README.md │ ├── build.rs │ ├── default.nix │ ├── examples │ │ ├── README.md │ │ ├── box.asm │ │ ├── fib.asm │ │ ├── mul.asm │ │ └── screen.asm │ ├── misc │ │ ├── box.png │ │ ├── characters.png │ │ ├── colors.png │ │ ├── demo.gif │ │ ├── fateful_icon.png │ │ ├── icon.png │ │ ├── screen.png │ │ └── vgapallete.png │ ├── os │ │ └── math.asm │ ├── peripherals │ │ ├── advanced │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ ├── c-peripheral │ │ │ ├── peripheral.c │ │ │ └── peripheral.h │ │ ├── multi-port │ │ │ ├── Cargo.lock │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ ├── rust-peripheral │ │ │ ├── Cargo.lock │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ ├── screen │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ └── zig-peripheral │ │ │ ├── build.zig │ │ │ └── src │ │ │ └── main.zig │ ├── shell.nix │ ├── src │ │ ├── assembler.rs │ │ ├── assembler │ │ │ ├── ascii.rs │ │ │ ├── eval.rs │ │ │ ├── generator.rs │ │ │ ├── include.rs │ │ │ ├── lex.rs │ │ │ ├── macros.asm │ │ │ ├── parse.rs │ │ │ └── token.rs │ │ ├── deploy.rs │ │ ├── diagnostic.rs │ │ ├── emulator.rs │ │ ├── emulator │ │ │ └── display.rs │ │ ├── main.rs │ │ ├── microcode.asm │ │ ├── tests.rs │ │ ├── vga-font.rom │ │ └── vga-text.font │ └── tests │ │ ├── arithmetic.asm │ │ ├── comments.asm │ │ ├── dio.asm │ │ ├── fib.asm │ │ ├── import.asm │ │ ├── mem.asm │ │ ├── screen.asm │ │ └── timeout.asm ├── functionhell │ ├── .gitignore │ ├── README.md │ ├── cmakelists.txt │ ├── editor │ │ ├── Makefile │ │ ├── package-lock.json │ │ ├── package.json │ │ └── src │ │ │ ├── caretPosition.js │ │ │ ├── config.json │ │ │ ├── index.html │ │ │ ├── main.js │ │ │ ├── preload.js │ │ │ ├── renderer.js │ │ │ ├── resizeHandler.js │ │ │ ├── saveLoad.js │ │ │ └── themes │ │ │ └── theme.json │ ├── examples │ │ ├── factorial.fh │ │ ├── fibonacci.fh │ │ ├── fizzbuzz.fh │ │ └── ramanujan-sato.fh │ └── src │ │ ├── errors │ │ ├── error.cpp │ │ └── error.hpp │ │ ├── lexer │ │ ├── lexer.cpp │ │ ├── lexer.hpp │ │ └── tokens │ │ │ ├── tokens.cpp │ │ │ └── tokens.hpp │ │ ├── main.cpp │ │ ├── parser │ │ ├── ast │ │ │ ├── ASTNodes.cpp │ │ │ ├── ASTNodes.hpp │ │ │ └── ASTNodesToTS.cpp │ │ ├── parser.cpp │ │ └── parser.hpp │ │ ├── transpiler │ │ ├── transpiler.cpp │ │ └── transpiler.hpp │ │ ├── typeChecker │ │ ├── typeChecker.cpp │ │ └── typeChecker.hpp │ │ └── utils │ │ ├── utils.cpp │ │ └── utils.hpp ├── h4x │ ├── Docs │ │ ├── library.md │ │ ├── quickstart.md │ │ └── stdlib.md │ ├── Examples │ │ ├── guess.h4x │ │ ├── h4x_in_y_minutes.h4x │ │ ├── hello.h4x │ │ └── nim.h4x │ ├── README.md │ ├── __pycache__ │ │ └── extras.cpython-38.pyc │ ├── demo.cast │ ├── extras.py │ ├── generate_sublime_highlight.py │ ├── h4x.sublime-syntax │ ├── h4x │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-38.pyc │ │ │ ├── datatypes.cpython-38.pyc │ │ │ ├── error.cpython-38.pyc │ │ │ ├── lexer.cpython-38.pyc │ │ │ ├── parser.cpython-38.pyc │ │ │ ├── runner.cpython-38.pyc │ │ │ └── tokens.cpython-38.pyc │ │ ├── datatypes.py │ │ ├── error.py │ │ ├── lexer.py │ │ ├── parser.py │ │ ├── runner.py │ │ ├── stdlib │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ │ ├── __init__.cpython-38.pyc │ │ │ │ ├── control_flow.cpython-38.pyc │ │ │ │ ├── example.cpython-38.pyc │ │ │ │ ├── list.cpython-38.pyc │ │ │ │ ├── operators.cpython-38.pyc │ │ │ │ ├── stdlib.cpython-38.pyc │ │ │ │ ├── str.cpython-38.pyc │ │ │ │ └── tosty.cpython-38.pyc │ │ │ ├── control_flow.py │ │ │ ├── example.py │ │ │ ├── list.py │ │ │ ├── operators.py │ │ │ ├── stdlib.py │ │ │ └── str.py │ │ └── tokens.py │ ├── intro.txt │ ├── main.py │ ├── repl.py │ ├── test.h4x │ └── tests │ │ ├── numbers.h4x │ │ └── stdlib.h4x ├── iris │ ├── LICENSE │ ├── README.md │ ├── examples │ │ ├── arcade.txt │ │ ├── calendar.txt │ │ ├── counter.txt │ │ └── loop.txt │ └── src │ │ ├── codegen.js │ │ ├── iris.js │ │ ├── lexer.js │ │ ├── package-lock.json │ │ ├── package.json │ │ └── parser.js ├── meowLang │ ├── README.md │ ├── ast.js │ ├── examples │ │ ├── ceaserCipher.meowLang │ │ └── leetCodeTwoSumHeHe.meowLang │ ├── interpreter.js │ ├── lexer.js │ ├── meowLang.js │ ├── package.json │ ├── parser.js │ └── stdlib.js ├── monopolang │ ├── .gitignore │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ ├── examples │ │ ├── factorial.mp │ │ ├── gambling.mp │ │ └── stocks.mp │ ├── src │ │ ├── ast.rs │ │ ├── compiler.rs │ │ ├── debug.rs │ │ ├── lexer.rs │ │ ├── main.rs │ │ ├── parser.rs │ │ ├── value.rs │ │ └── vm.rs │ └── testing │ │ ├── concatenate.mp │ │ ├── econ.mp │ │ ├── econ_testing.mp │ │ ├── factorial.mp │ │ ├── loans.mp │ │ ├── looped_procs.mp │ │ ├── loops.mp │ │ ├── nesting.mp │ │ ├── proc.mp │ │ ├── proc_loops.mp │ │ ├── recursive_proc_loops.mp │ │ ├── simple.mp │ │ ├── test.mp │ │ └── work.mp ├── nil │ ├── Cargo.toml │ ├── DOCS.md │ ├── LICENSE │ ├── README.md │ ├── TODO.md │ ├── demos │ │ ├── fibonacci.nil │ │ ├── fizzbuzz.nil │ │ └── game.nil │ └── src │ │ ├── main.rs │ │ └── nil │ │ ├── errorhandler.rs │ │ ├── evaluate.rs │ │ ├── grammar.rs │ │ ├── lexer.rs │ │ ├── mod.rs │ │ ├── parser.rs │ │ ├── scope.rs │ │ ├── specialforms.rs │ │ └── token.rs ├── treestack │ ├── Cargo.lock │ ├── Cargo.toml │ ├── README.md │ ├── demo.cast │ ├── examples │ │ ├── broken │ │ │ └── topdownmovement.tsk │ │ ├── editor.tsk │ │ ├── error.tsk │ │ ├── factorial.tsk │ │ ├── fib.tsk │ │ ├── file.tsk │ │ ├── helloworld.tsk │ │ ├── rawmode.tsk │ │ ├── roguelike.tsk │ │ ├── sort.tsk │ │ └── torus.tsk │ ├── operators.md │ ├── src │ │ ├── error.rs │ │ ├── interpreter.rs │ │ ├── lexer.rs │ │ ├── main.rs │ │ ├── parser.rs │ │ ├── repl.rs │ │ └── tree.rs │ ├── treestack.vim │ └── words.md └── λ │ ├── README.md │ ├── examples │ ├── factorial.λ │ └── fib.λ │ └── λ.py └── site ├── components ├── Canvas.tsx ├── Editor.module.scss ├── Editor.tsx ├── Interpreter.tsx ├── Mermaid.tsx ├── Runtime.tsx ├── easel.grammar ├── easel.js ├── highlight.js ├── interactive │ ├── Confetti.tsx │ ├── Lexer.module.scss │ ├── Lexer.tsx │ ├── Node.module.scss │ ├── Node.tsx │ ├── Pancakes.module.scss │ └── Pancakes.tsx ├── invalidBirthdate.ts ├── parser.js ├── parser.terms.js └── trim.ts ├── content ├── orpheus-decodes-program.mdx ├── orpheus-finds-easel.mdx ├── orpheus-writes-interpreter.mdx ├── orpheus-writes-lexer.mdx └── orpheus-writes-parser.mdx ├── index.tsx ├── next.config.mjs ├── package-lock.json ├── package.json ├── pages ├── [slug].tsx ├── _app.tsx ├── _document.tsx ├── api │ ├── stickers.ts │ └── submit.ts ├── stickers.tsx └── submit.tsx ├── public ├── FiraCode.ttf ├── IBMPlexSans-Italic.ttf ├── IBMPlexSans-Medium.ttf ├── IBMPlexSans-MediumItalic.ttf ├── IBMPlexSans-Regular.ttf ├── Newsreader-Italic.ttf ├── Newsreader.ttf ├── Virgil.woff2 └── cartoons │ ├── binop.png │ ├── english-tokens.png │ ├── layout.jpg │ ├── lexer-diagram.png │ ├── neopixels.png │ ├── painter.jpg │ ├── pemdas.png │ ├── placeholder.png │ ├── repl-time.png │ ├── site.png │ ├── tea.png │ ├── types.png │ └── wizard.png ├── rollup.config.js ├── styles ├── Landing.module.scss ├── Part.module.scss ├── Submit.module.scss ├── breakpoints.scss └── globals.scss └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | test 4 | 5 | # dependencies 6 | node_modules 7 | /.pnp 8 | .pnp.js 9 | .yarn/install-state.gz 10 | 11 | # testing 12 | /coverage 13 | 14 | # next.js 15 | .next 16 | /out/ 17 | 18 | # production 19 | /build 20 | 21 | # misc 22 | .DS_Store 23 | *.pem 24 | 25 | # debug 26 | npm-debug.log* 27 | yarn-debug.log* 28 | yarn-error.log* 29 | 30 | # local env files 31 | .env*.local 32 | 33 | # vercel 34 | .vercel 35 | 36 | # typescript 37 | *.tsbuildinfo 38 | next-env.d.ts 39 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | package.json 2 | package-lock.json 3 | .next/* 4 | *.mdx -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSameLine": true, 4 | "singleQuote": true, 5 | "quoteProps": "consistent", 6 | "semi": false, 7 | "tabWidth": 2, 8 | "trailingComma": "none" 9 | } -------------------------------------------------------------------------------- /languages/Eia64/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea/modules.xml 9 | .idea/jarRepositories.xml 10 | .idea/compiler.xml 11 | .idea/libraries/ 12 | *.iws 13 | *.iml 14 | *.ipr 15 | out/ 16 | !**/src/main/**/out/ 17 | !**/src/test/**/out/ 18 | 19 | ### Eclipse ### 20 | .apt_generated 21 | .classpath 22 | .factorypath 23 | .project 24 | .settings 25 | .springBeans 26 | .sts4-cache 27 | bin/ 28 | !**/src/main/**/bin/ 29 | !**/src/test/**/bin/ 30 | 31 | ### NetBeans ### 32 | /nbproject/private/ 33 | /nbbuild/ 34 | /dist/ 35 | /nbdist/ 36 | /.nb-gradle/ 37 | 38 | ### VS Code ### 39 | .vscode/ 40 | 41 | ### Mac OS ### 42 | .DS_Store -------------------------------------------------------------------------------- /languages/Eia64/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /languages/Eia64/.idea/.name: -------------------------------------------------------------------------------- 1 | Eia64 -------------------------------------------------------------------------------- /languages/Eia64/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | -------------------------------------------------------------------------------- /languages/Eia64/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /languages/Eia64/.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /languages/Eia64/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /languages/Eia64/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /languages/Eia64/Eia64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/Eia64/Eia64.jar -------------------------------------------------------------------------------- /languages/Eia64/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("java") 3 | kotlin("jvm") 4 | } 5 | 6 | group = "space.themelon.eia64" 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | mavenCentral() 11 | } 12 | 13 | dependencies { 14 | testImplementation(platform("org.junit:junit-bom:5.10.0")) 15 | testImplementation("org.junit.jupiter:junit-jupiter") 16 | implementation(kotlin("stdlib-jdk8")) 17 | 18 | testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") 19 | testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2") 20 | } 21 | 22 | tasks.test { 23 | useJUnitPlatform() 24 | } 25 | 26 | tasks.register("fatJar") { 27 | archiveClassifier.set("all") 28 | manifest { 29 | attributes("Main-Class" to "space.themelon.eia64.Main") 30 | } 31 | from({ 32 | configurations.compileClasspath.get().filter { 33 | it.exists() 34 | }.map { 35 | if (it.isDirectory) it else project.zipTree(it) 36 | } 37 | }) 38 | with(tasks.jar.get()) 39 | duplicatesStrategy = DuplicatesStrategy.WARN 40 | } 41 | 42 | kotlin { 43 | jvmToolchain(11) 44 | } -------------------------------------------------------------------------------- /languages/Eia64/examples/LevenshteinDistance.eia: -------------------------------------------------------------------------------- 1 | ; calculates levenshtein distance between two strings 2 | ; also an example demonstrating use of arrays 3 | 4 | include( 5 | static:std:math 6 | ) 7 | 8 | private fn compute(first: String, second: String): Int { 9 | let lenFirst = len(first) 10 | let lenSecond = len(second) 11 | 12 | let dist = makeArray>(lenFirst + 1, arrayOf(0)) 13 | for (var i = 0, i < lenFirst + 1, i++) 14 | dist[i] = makeArray(lenSecond + 1, 0) 15 | 16 | for (var i = 0, i <= lenFirst, i++) dist[i][0] = copy(i) 17 | for (var j = 0, j <= lenSecond, j++) dist[0][j] = copy(j) 18 | 19 | for (var i = 1, i <= lenFirst, i++) { 20 | for (var j = 1, j <= lenSecond, j++) { 21 | let cost = if (first[i - 1] == second[j - 1]) 0 else 1 22 | dist[i][j] = math.min( 23 | math.min(dist[i - 1][j] + 1, 24 | dist[i][j - 1] + 1), 25 | dist[i - 1][j - 1] + cost 26 | ) 27 | } 28 | } 29 | return dist[lenFirst][lenSecond] 30 | } 31 | 32 | let first = "flamenco" 33 | let second = "flamingo" 34 | println("Distance: ", compute(first, second)) -------------------------------------------------------------------------------- /languages/Eia64/examples/MathSteps.eia: -------------------------------------------------------------------------------- 1 | println("Are you good at math? Let's start with simple problems, lets see how long you will last!") 2 | 3 | var x = 2 4 | until (true) { 5 | println(format("What is %d+%d?", x, x)) 6 | let answer = int(readln()) 7 | if (answer == x + x) { 8 | print("Ok, ") 9 | x++ 10 | } else { 11 | println(format("Eh you only lasted %d rounds", x - 1)) 12 | x = 2 13 | } 14 | } -------------------------------------------------------------------------------- /languages/Eia64/examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | These are some of the cool stuff written in Eia64! 4 | ``` 5 | java -jar Eia64.jar examples/animation.eia 6 | ``` 7 | 8 | `animation.eia` [Trash Guy](https://zac.cy/trashguy/) animation written in Eia!\ 9 | `mathsolver.eia` What about a simple math interpreter written in a language in a language 👀\ 10 | `superfib.eia` Benchmarking through `fib()` function⚡️\ 11 | `rockpaperscissor.eia` Play Rock Paper Scissor with robot 🤖\ 12 | `LevenshteinDistance.eia` Algorithm written in Eia64 to calculate leven distance of two strings -------------------------------------------------------------------------------- /languages/Eia64/examples/superfib.eia: -------------------------------------------------------------------------------- 1 | ; fib(n) function written to benchmark performance 2 | 3 | private fn fib(n: Int): Int = 4 | if (n < 2) n 5 | else fib(n - 1) + fib(n - 2) 6 | 7 | fn main() { 8 | let startTime = time() 9 | 10 | println( 11 | "Result: " + fib(30), 12 | format(" took %d ms", time() - startTime) 13 | ) 14 | } -------------------------------------------------------------------------------- /languages/Eia64/good.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/Eia64/good.gif -------------------------------------------------------------------------------- /languages/Eia64/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/Eia64/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /languages/Eia64/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 14 22:16:00 IST 2024 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /languages/Eia64/graphics/interactive_shell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/Eia64/graphics/interactive_shell.png -------------------------------------------------------------------------------- /languages/Eia64/graphics/nest_shell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/Eia64/graphics/nest_shell.png -------------------------------------------------------------------------------- /languages/Eia64/pipes.txt: -------------------------------------------------------------------------------- 1 | pipe command where Eia64 displays runtime logs output 2 | 3 | mkfifo /tmp/pipe1 -------------------------------------------------------------------------------- /languages/Eia64/promo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/Eia64/promo.gif -------------------------------------------------------------------------------- /languages/Eia64/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | plugins { 3 | kotlin("jvm") version "2.0.0" 4 | } 5 | } 6 | plugins { 7 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" 8 | } 9 | rootProject.name = "Eia64" 10 | include("tests") 11 | -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/DevStart.java: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64; 2 | 3 | public class DevStart { 4 | public static void main(String[] args) { 5 | Main.main(new String[] { 6 | "/home/kumaraswamy/Documents/Eia64/testfiles/stdlibtest/advanced_recursion_test.eia" 7 | }); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/TerminalColors.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64 2 | 3 | object TerminalColors { 4 | const val RESET: String = "\u001b[0m" 5 | 6 | const val BLACK: String = "\u001b[0;30m" 7 | const val RED: String = "\u001b[0;31m" 8 | const val GREEN: String = "\u001b[0;32m" 9 | const val YELLOW: String = "\u001b[0;33m" 10 | const val BLUE: String = "\u001b[0;34m" 11 | const val PURPLE: String = "\u001b[0;35m" 12 | const val CYAN: String = "\u001b[0;36m" 13 | const val WHITE: String = "\u001b[0;37m" 14 | const val BOLD: String = "\u001b[1m" 15 | const val UNDERLINE: String = "\u001b[4m" 16 | 17 | const val GOLD: String = "\u001b[38;2;255;215;0m" 18 | 19 | const val BLACK_BG = "\u001B[40m" 20 | const val RED_BG = "\u001B[41m" 21 | const val GREEN_BG = "\u001B[42m" 22 | const val YELLOW_BG = "\u001B[43m" 23 | const val BLUE_BG = "\u001B[44m" 24 | const val PURPLE_BG = "\u001B[45m" 25 | const val CYAN_BG = "\u001B[46m" 26 | const val WHITE_BG = "\u001B[47m" 27 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/analysis/FunctionReference.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.analysis 2 | 3 | import space.themelon.eia64.expressions.FunctionExpr 4 | import space.themelon.eia64.signatures.Signature 5 | import space.themelon.eia64.syntax.Token 6 | 7 | data class FunctionReference( 8 | val where: Token, 9 | val name: String, 10 | var fnExpression: FunctionExpr? = null, 11 | val parameters: List>, // List < < ParameterName, Signature > 12 | val argsSize: Int, 13 | val returnSignature: Signature, 14 | val isVoid: Boolean, 15 | val public: Boolean, 16 | val tokenIndex: Int 17 | ) { 18 | // it is important to override toString() or else it may cause recursive StackOverFlow error 19 | override fun toString() = "<${fnExpression?.name ?: "UnsetFunctionReference"}()>" 20 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/analysis/ModuleInfo.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.analysis 2 | 3 | import space.themelon.eia64.syntax.Token 4 | 5 | data class ModuleInfo( 6 | val where: Token, // for debugging and throwing errors 7 | val name: String, 8 | // linked indicates if the module is associated with 9 | // a specific data type, such as " a string ", number 123, or an array 10 | val linked: Boolean 11 | ) -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/analysis/TestModule.java: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.analysis; 2 | 3 | import space.themelon.eia64.runtime.Executor; 4 | import space.themelon.eia64.syntax.Lexer; 5 | 6 | public class TestModule { 7 | 8 | public final Object lock = new Object(); 9 | 10 | public void loadModule() { 11 | synchronized(lock) { 12 | for (;;) { 13 | ParserX parser = new ParserX(new Executor()); 14 | parser.parse(new Lexer("a = 5").getTokens()); 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/analysis/UniqueFunction.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.analysis 2 | 3 | data class UniqueFunction( 4 | val name: String, 5 | val numArgs: Int, 6 | ) -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/analysis/UniqueVariable.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.analysis 2 | 3 | import space.themelon.eia64.signatures.Signature 4 | 5 | data class UniqueVariable( 6 | val index: Int, // nth variable in scope 7 | val mutable: Boolean, 8 | val signature: Signature, 9 | val public: Boolean 10 | ) -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/analysis/VariableReference.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.analysis 2 | 3 | import space.themelon.eia64.signatures.Signature 4 | 5 | class VariableReference( 6 | var index: Int, 7 | var signature: Signature 8 | ) -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/Alpha.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Signature 5 | import space.themelon.eia64.signatures.SimpleSignature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class Alpha( 9 | val where: Token, 10 | val index: Int, 11 | val value: String, 12 | val sign: Signature, 13 | ) : Expression(where) { 14 | 15 | override fun accept(v: Visitor) = v.alpha(this) 16 | override fun sig() = sign 17 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/ArrayAccess.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.ArrayExtension 5 | import space.themelon.eia64.signatures.Sign 6 | import space.themelon.eia64.signatures.Signature 7 | import space.themelon.eia64.syntax.Token 8 | 9 | data class ArrayAccess( 10 | val where: Token, 11 | val expr: Expression, 12 | val index: Expression 13 | ) : Expression(where) { 14 | 15 | override fun accept(v: Visitor) = v.arrayAccess(this) 16 | 17 | // Verify -> child 18 | override fun sig(): Signature { 19 | when (val exprSig = expr.sig()) { 20 | Sign.STRING -> return Sign.CHAR 21 | is ArrayExtension -> return exprSig.elementSignature 22 | Sign.ARRAY -> return Sign.ANY 23 | else -> where.error("Unknown element to perform array operation") 24 | } 25 | throw RuntimeException() 26 | } 27 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/ArrayAllocation.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.* 5 | import space.themelon.eia64.signatures.Matching.matches 6 | import space.themelon.eia64.syntax.Token 7 | 8 | class ArrayAllocation( 9 | val where: Token, 10 | private val elementSignature: Signature, 11 | val size: Expression, 12 | val defaultValue: Expression, 13 | ) : Expression(where) { 14 | 15 | override fun accept(v: Visitor) = v.arrayAllocation(this) 16 | 17 | override fun sig(): Signature { 18 | val gotSig = size.sig() 19 | if (!matches(Sign.INT, gotSig)) { 20 | where.error("Array allocation expects an Int for array length, but got $gotSig") 21 | } 22 | if (!matches(elementSignature, defaultValue.sig())) { 23 | where.error("arralloc() element signature and default value does not match (type mismatch)") 24 | } 25 | return ArrayExtension(elementSignature) 26 | } 27 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/AutoVariable.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.syntax.Token 5 | 6 | data class AutoVariable( 7 | val where: Token, 8 | val name: String, 9 | val expr: Expression 10 | ) : Expression(where) { 11 | 12 | override fun accept(v: Visitor) = v.autoVariable(this) 13 | 14 | override fun sig() = expr.sig() 15 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/BoolLiteral.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.SimpleSignature 5 | import space.themelon.eia64.signatures.Sign 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class BoolLiteral( 9 | val where: Token, 10 | val value: Boolean 11 | ) : Expression(where) { 12 | 13 | override fun accept(v: Visitor) = v.boolLiteral(this) 14 | 15 | override fun sig() = Sign.BOOL 16 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/CharLiteral.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.SimpleSignature 5 | import space.themelon.eia64.signatures.Sign 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class CharLiteral( 9 | val where: Token, 10 | val value: Char 11 | ) : Expression(where) { 12 | 13 | override fun accept(v: Visitor) = v.charLiteral(this) 14 | 15 | override fun sig() = Sign.CHAR 16 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/ExplicitVariable.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Matching.matches 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class ExplicitVariable( 9 | val where: Token, 10 | val mutable: Boolean, 11 | val name: String, 12 | val expr: Expression, 13 | val explicitSignature: Signature 14 | ) : Expression(where) { 15 | 16 | init { 17 | sig() 18 | } 19 | 20 | override fun accept(v: Visitor) = v.variable(this) 21 | 22 | override fun sig(): Signature { 23 | val exprSig = expr.sig() 24 | if (!matches(expect = explicitSignature, got = exprSig)) { 25 | where.error("Variable '$name' expected signature $explicitSignature but got $exprSig") 26 | throw RuntimeException() 27 | } 28 | return explicitSignature 29 | } 30 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/FloatLiteral.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.syntax.Token 6 | 7 | data class FloatLiteral( 8 | val where: Token, 9 | val value: Float 10 | ) : Expression(where) { 11 | 12 | override fun accept(v: Visitor) = v.floatLiteral(this) 13 | 14 | override fun sig() = Sign.FLOAT 15 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/ForEach.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class ForEach( 9 | val where: Token, 10 | val name: String, 11 | val entity: Expression, // sig checked 12 | val body: Expression, // sig checked 13 | ) : Expression(where) { 14 | 15 | override fun accept(v: Visitor) = v.forEach(this) 16 | 17 | override fun sig(): Signature { 18 | entity.sig() 19 | body.sig() 20 | return Sign.NONE 21 | } 22 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/ForLoop.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class ForLoop( 9 | val where: Token, 10 | val initializer: Expression?, // sig checked 11 | val conditional: Expression?, // sig checked 12 | val operational: Expression?, // sig checked 13 | val body: Expression, 14 | ) : Expression(where) { 15 | 16 | override fun accept(v: Visitor) = v.forLoop(this) 17 | 18 | override fun sig(): Signature { 19 | initializer?.sig() 20 | conditional?.sig() 21 | operational?.sig() 22 | body.sig() 23 | 24 | return Sign.NONE 25 | } 26 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/ForeignField.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.analysis.ModuleInfo 5 | import space.themelon.eia64.analysis.UniqueVariable 6 | import space.themelon.eia64.signatures.Signature 7 | import space.themelon.eia64.syntax.Token 8 | 9 | data class ForeignField( 10 | val where: Token, 11 | val static: Boolean, 12 | val objectExpression: Expression, 13 | val property: String, 14 | val uniqueVariable: UniqueVariable, 15 | val moduleInfo: ModuleInfo, 16 | ): Expression(where) { 17 | 18 | override fun accept(v: Visitor) = v.classPropertyAccess(this) 19 | 20 | override fun sig(): Signature { 21 | objectExpression.sig() 22 | return uniqueVariable.signature 23 | } 24 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/FunctionExpr.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Matching.matches 5 | import space.themelon.eia64.signatures.Sign 6 | import space.themelon.eia64.signatures.Signature 7 | import space.themelon.eia64.syntax.Token 8 | 9 | data class FunctionExpr( 10 | val where: Token, 11 | val name: String, 12 | val arguments: List>, // List< > 13 | val isVoid: Boolean, 14 | val returnSignature: Signature, 15 | val body: Expression // sig checked 16 | ) : Expression(where) { 17 | 18 | override fun accept(v: Visitor) = v.function(this) 19 | 20 | override fun sig(): Signature { 21 | body.sig() 22 | val receivedSignature = if (body is ExpressionList) body.returnSig() else body.sig() 23 | if (!isVoid && !matches(returnSignature, receivedSignature)) { 24 | where.error("Promised return signature $returnSignature but got $receivedSignature") 25 | } 26 | return Sign.NONE 27 | } 28 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/Include.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.SimpleSignature 5 | import space.themelon.eia64.signatures.Sign 6 | 7 | data class Include( 8 | val names: List 9 | ) : Expression(null) { 10 | 11 | override fun accept(v: Visitor): R = v.include(this) 12 | 13 | override fun sig() = Sign.NONE 14 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/IntLiteral.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.SimpleSignature 5 | import space.themelon.eia64.signatures.Sign 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class IntLiteral( 9 | val where: Token, 10 | val value: Int 11 | ) : Expression(where) { 12 | 13 | override fun accept(v: Visitor) = v.intLiteral(this) 14 | 15 | override fun sig() = Sign.INT 16 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/Interruption.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | import space.themelon.eia64.syntax.Type 8 | 9 | data class Interruption( 10 | val where: Token, 11 | val operator: Type, 12 | val expr: Expression? = null // sig checked 13 | ) : Expression(where) { 14 | 15 | override fun accept(v: Visitor) = v.interruption(this) 16 | 17 | override fun sig(): Signature { 18 | expr?.sig() // necessary 19 | 20 | if (operator == Type.RETURN || operator == Type.USE) { 21 | if (expr == null) { 22 | // `return` may not have an expression, but `use` must. 23 | if (operator == Type.USE) { 24 | where.error("No expression for operator $operator provided") 25 | } else return Sign.ANY 26 | } 27 | return expr!!.sig() 28 | } 29 | return Sign.ANY 30 | } 31 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/IsStatement.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | 7 | data class IsStatement( 8 | val expression: Expression, // sig checked 9 | val signature: Signature, 10 | ): Expression() { 11 | 12 | override fun accept(v: Visitor) = v.isStatement(this) 13 | 14 | override fun sig(): Signature { 15 | expression.sig() // necessary 16 | return Sign.BOOL 17 | } 18 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/Itr.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class Itr( 9 | val where: Token, 10 | val name: String, 11 | val from: Expression, // sig checked 12 | val to: Expression, // sig checked 13 | val by: Expression?, // sig checked 14 | val body: Expression, // sig checked 15 | ) : Expression(where) { 16 | 17 | override fun accept(v: Visitor) = v.itr(this) 18 | 19 | override fun sig(): Signature { 20 | from.sig() 21 | to.sig() 22 | by?.sig() 23 | body.sig() 24 | return Sign.ANY 25 | } 26 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/NilLiteral.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.syntax.Token 6 | 7 | data class NilLiteral(val where: Token): Expression(where) { 8 | override fun accept(v: Visitor) = v.nilLiteral(this) 9 | 10 | override fun sig() = Sign.NIL 11 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/NoneExpression.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | 6 | class NoneExpression: Expression() { 7 | 8 | companion object { 9 | val INSTANCE = NoneExpression() 10 | } 11 | 12 | override fun accept(v: Visitor) = v.noneExpression() 13 | override fun sig() = Sign.NONE 14 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/Scope.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | 5 | data class Scope( 6 | val expr: Expression, // sig checked 7 | val imaginary: Boolean 8 | ) : Expression(null) { 9 | 10 | override fun accept(v: Visitor) = v.scope(this) 11 | 12 | override fun sig() = expr.sig() 13 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/ShadoInvoke.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class ShadoInvoke( 9 | val where: Token, 10 | val expr: Expression, 11 | val arguments: List 12 | ) : Expression(where) { 13 | 14 | override fun accept(v: Visitor) = v.unitInvoke(this) 15 | 16 | override fun sig(): Signature { 17 | // nessasary 18 | expr.sig() 19 | arguments.forEach { it.sig() } 20 | return Sign.ANY 21 | } 22 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/Shadow.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | 7 | data class Shadow( 8 | val names: List, 9 | val body: Expression 10 | ) : Expression() { 11 | 12 | override fun accept(v: Visitor) = v.shado(this) 13 | 14 | override fun sig(): Signature { 15 | body.sig() 16 | return Sign.UNIT 17 | } 18 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/StringLiteral.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.SimpleSignature 5 | import space.themelon.eia64.signatures.Sign 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class StringLiteral( 9 | val where: Token, 10 | val value: String 11 | ) : Expression(where) { 12 | 13 | override fun accept(v: Visitor) = v.stringLiteral(this) 14 | 15 | override fun sig() = Sign.STRING 16 | } 17 | -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/ThrowExpr.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class ThrowExpr( 9 | val where: Token, 10 | val error: Expression // sig checked 11 | ) : Expression(where) { 12 | 13 | override fun accept(v: Visitor) = v.throwExpr(this) 14 | 15 | override fun sig(): Signature { 16 | error.sig() // necessary 17 | return Sign.NONE 18 | } 19 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/TryCatch.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class TryCatch( 9 | val where: Token, 10 | val tryBlock: Expression, // sig checked 11 | val catchIdentifier: String, 12 | val catchBlock: Expression, // sig checked 13 | ): Expression(where) { 14 | 15 | override fun accept(v: Visitor) = v.tryCatch(this) 16 | 17 | override fun sig(): Signature { 18 | val trySignature = tryBlock.sig() 19 | val catchSignature = catchBlock.sig() 20 | 21 | if (trySignature == catchSignature) return trySignature 22 | return Sign.ANY 23 | } 24 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/TypeLiteral.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class TypeLiteral( 9 | val where: Token, 10 | val signature: Signature 11 | ): Expression(where) { 12 | override fun accept(v: Visitor) = v.typeLiteral(this) 13 | 14 | override fun sig() = Sign.TYPE 15 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/Until.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class Until( 9 | val where: Token, 10 | val expression: Expression, // sig checked 11 | val body: Expression, // sig checked 12 | ) : Expression(where) { 13 | 14 | override fun accept(v: Visitor) = v.until(this) 15 | 16 | override fun sig(): Signature { 17 | expression.sig() 18 | body.sig() 19 | return Sign.ANY 20 | } 21 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/expressions/When.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.expressions 2 | 3 | import space.themelon.eia64.Expression 4 | import space.themelon.eia64.signatures.Sign 5 | import space.themelon.eia64.signatures.Signature 6 | import space.themelon.eia64.syntax.Token 7 | 8 | data class When( 9 | val where: Token, 10 | val expr: Expression, 11 | val matches: List>, // , sig checked 12 | val defaultBranch: Expression, 13 | ) : Expression(where) { 14 | 15 | override fun accept(v: Visitor) = v.whenExpr(this) 16 | 17 | override fun sig(): Signature { 18 | // necessary 19 | matches.forEach { it.first.sig(); it.second.sig() } 20 | 21 | // it checks if all the body expressions, including that of `else` 22 | // returns holds same signature, else it returns type Any 23 | val sign = defaultBranch.sig() 24 | for (match in matches) { 25 | if (sign != match.second.sig()) { 26 | return Sign.ANY 27 | } 28 | } 29 | return sign 30 | } 31 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/primitives/ArrayOperable.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.primitives 2 | 3 | interface ArrayOperable { 4 | fun getAt(index: Int): T 5 | fun setAt(index: Int, value: T) 6 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/primitives/EChar.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.primitives 2 | 3 | class EChar(initialValue: Char): Primitive { 4 | 5 | private var charValue = initialValue 6 | 7 | override fun set(value: Any) { 8 | if (value !is EChar) 9 | throw IllegalArgumentException("EChar.set() value is not a Char") 10 | charValue = value.charValue 11 | } 12 | 13 | override fun get() = charValue 14 | override fun stdlibName() = "char" 15 | 16 | override fun isCopyable() = true 17 | override fun copy() = EChar(charValue) 18 | 19 | override fun toString() = charValue.toString() 20 | 21 | override fun equals(other: Any?): Boolean { 22 | if (this === other) return true 23 | if (other !is EChar) return false 24 | return charValue == other.charValue 25 | } 26 | 27 | override fun hashCode() = charValue.hashCode() 28 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/primitives/ENil.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.primitives 2 | 3 | class ENil: Primitive { 4 | override fun set(value: Any) { 5 | throw UnsupportedOperationException() 6 | } 7 | 8 | override fun get(): Any { 9 | throw UnsupportedOperationException() 10 | } 11 | 12 | override fun stdlibName(): String { 13 | throw UnsupportedOperationException() 14 | } 15 | 16 | override fun isCopyable() = true 17 | 18 | override fun copy(): ENil = this 19 | 20 | override fun equals(other: Any?) = other is ENil 21 | override fun hashCode() = 0 22 | 23 | override fun toString() = "ENil" 24 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/primitives/EType.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.primitives 2 | 3 | import space.themelon.eia64.signatures.Matching.matches 4 | import space.themelon.eia64.signatures.Signature 5 | 6 | class EType( 7 | val signature: Signature 8 | ): Primitive { 9 | 10 | override fun set(value: Any) { 11 | throw UnsupportedOperationException() 12 | } 13 | 14 | override fun get() = signature 15 | 16 | // TODO: 17 | // we can have a stdlib for this! 18 | // Imagine this: 19 | // let a = type::String 20 | // println(a.isStdLib() 21 | // println(a.path()) that would be fun 22 | override fun stdlibName() = "etype" 23 | 24 | override fun isCopyable() = true 25 | // Just return the same instance, this instance would never 26 | // Change, so it doesn't make a difference 27 | override fun copy() = this 28 | 29 | override fun equals(other: Any?) = other is EType && 30 | (matches(signature, other.signature) || matches(other.signature, signature)) 31 | override fun hashCode() = signature.hashCode() 32 | 33 | override fun toString() = "Type(${signature.logName()})" 34 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/primitives/Primitive.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.primitives 2 | 3 | interface Primitive { 4 | fun set(value: Any) 5 | fun get(): Any 6 | fun stdlibName(): String 7 | fun isCopyable(): Boolean 8 | fun copy(): T 9 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/runtime/EiaRuntimeException.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.runtime 2 | 3 | class EiaRuntimeException(override val message: String): Exception(message) -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/runtime/InterruptionType.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.runtime 2 | 3 | enum class InterruptionType { 4 | NONE, 5 | RETURN, 6 | USE, 7 | BREAK, 8 | CONTINUE, 9 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/runtime/Nothing.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.runtime 2 | 3 | class Nothing { 4 | companion object { 5 | val INSTANCE = Nothing() 6 | } 7 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/runtime/ShutdownException.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.runtime 2 | 3 | class ShutdownException: Exception() -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/signatures/ArrayExtension.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.signatures 2 | 3 | class ArrayExtension( 4 | val elementSignature: Signature 5 | ): Signature() { 6 | override fun equals(other: Any?) = other is ArrayExtension && other.elementSignature == elementSignature 7 | 8 | override fun hashCode() = elementSignature.hashCode() 9 | 10 | override fun logName() = "Array<$elementSignature>" 11 | 12 | override fun toString() = "ArrayExtension<$elementSignature>" 13 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/signatures/ObjectExtension.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.signatures 2 | 3 | class ObjectExtension( 4 | val extensionClass: String // could be `Object` or a `Car` (Object extension) or a `Bus` 5 | ) : Signature() { 6 | override fun equals(other: Any?) = other is ObjectExtension && other.extensionClass == extensionClass 7 | 8 | override fun logName() = "Object<$extensionClass>" 9 | 10 | override fun hashCode() = extensionClass.hashCode() 11 | 12 | override fun toString() = "ObjectExtension<$extensionClass>" 13 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/signatures/Signature.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.signatures 2 | 3 | abstract class Signature { 4 | fun isInt() = this == Sign.INT 5 | fun isFloat() = this == Sign.FLOAT 6 | 7 | fun isNumeric() = this == Sign.NUM || this == Sign.INT || this == Sign.FLOAT 8 | fun isNumericOrChar() = isNumeric() || this == Sign.CHAR 9 | 10 | abstract fun logName(): String 11 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/signatures/SimpleSignature.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.signatures 2 | 3 | class SimpleSignature(val type: String) : Signature() { 4 | override fun equals(other: Any?) = other is SimpleSignature && other.type == type 5 | override fun hashCode() = type.hashCode() 6 | 7 | override fun logName() = type 8 | 9 | override fun toString() = "<$type>" 10 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/syntax/Flag.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.syntax 2 | 3 | enum class Flag { 4 | ASSIGNMENT_TYPE, 5 | IS, 6 | LOGICAL_OR, LOGICAL_AND, 7 | BITWISE_OR, BITWISE_AND, 8 | 9 | EQUALITY, RELATIONAL, BINARY, BINARY_L2, BINARY_L3, 10 | OPERATOR, PRESERVE_ORDER, 11 | UNARY, POSSIBLE_RIGHT_UNARY, 12 | 13 | CLASS, 14 | E_BOOL, 15 | 16 | MODIFIER, 17 | VALUE, 18 | CONSTANT_VALUE, 19 | 20 | V_KEYWORD, 21 | 22 | LOOP, 23 | NATIVE_CALL, 24 | INTERRUPTION, 25 | NONE, 26 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/java/space/themelon/eia64/syntax/StaticToken.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64.syntax 2 | 3 | data class StaticToken(val type: Type, val flags: Array = emptyArray()) { 4 | 5 | fun normalToken(lineCount: Int) = Token(lineCount, type, flags) 6 | 7 | override fun equals(other: Any?): Boolean { 8 | if (this === other) return true 9 | if (javaClass != other?.javaClass) return false 10 | 11 | other as StaticToken 12 | 13 | if (type != other.type) return false 14 | if (!flags.contentEquals(other.flags)) return false 15 | 16 | return true 17 | } 18 | 19 | override fun hashCode(): Int { 20 | var result = type.hashCode() 21 | result = 31 * result + flags.contentHashCode() 22 | return result 23 | } 24 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: space.themelon.eia64.Eia 3 | 4 | -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/benchmarking.eia: -------------------------------------------------------------------------------- 1 | let startTime = time() 2 | fn fib(n: Int) = if (n < 2) n else fib(n - 1) + fib(n - 2) 3 | println(format("Result %s, took %s millis", fib(30), time() - startTime)) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/breakittest.eia: -------------------------------------------------------------------------------- 1 | let x = if (false) 5 2 | println(x) 3 | 4 | let someFn = fn hello(name: String) { println("Hello: " + name) } 5 | println(someFn) 6 | hello("Kumaraswamy") 7 | 8 | var i = 0 9 | let y = until (i++ < 5) { } 10 | println(y == 5) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/bubblesort.eia: -------------------------------------------------------------------------------- 1 | fn sort(ints: Array) { 2 | let n = len(ints) - 1 3 | 4 | var swapped = false 5 | for (var i = 0, i < n, i++) { 6 | swapped = false 7 | for (var j = 0, j < n - i, j++) { 8 | if (ints[j] > ints[j + 1]) { 9 | let temp = ints[j] 10 | ints[j] = ints[j + 1] 11 | ints[j + 1] = temp 12 | swapped = true 13 | } 14 | } 15 | if (!swapped) break 16 | } 17 | } 18 | 19 | let nums = ~{ 64 34 25 12 22 11 90 } 20 | sort(nums) 21 | println(nums) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/classimportests.eia: -------------------------------------------------------------------------------- 1 | stdlib(math, array, string) 2 | 3 | println("m i a w".split(" ")) 4 | println(math.min(5, 6)) 5 | println(~{1 2 3}.contains(3)) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/classplan.eia: -------------------------------------------------------------------------------- 1 | // private variable declarations 2 | 3 | fn _init(x: Int, y: Int) { 4 | // the class would begin here 5 | // these type of classes would be initialized using 6 | // let myList = init(:List, 5, 10) 7 | // myList would be of an Object element type that could be dynamically called 8 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/compoundoperators.eia: -------------------------------------------------------------------------------- 1 | let x = 10 2 | println(x += 5) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/crashparser.eia: -------------------------------------------------------------------------------- 1 | :! "5" -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/demo.eia: -------------------------------------------------------------------------------- 1 | stdlib(math) 2 | 3 | let x = ~{2 4 6 8} 4 | println(math.avg(x)) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/dynamicload.eia: -------------------------------------------------------------------------------- 1 | stdlib("math") 2 | 3 | fn sayHello(name: String) { 4 | println(format("Hello %s!", name)) 5 | } 6 | 7 | sayHello("Kumaraswamy") 8 | 9 | math.avg(~{5, 8}) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/fixtest.eia: -------------------------------------------------------------------------------- 1 | var square_result = 0 2 | var n = 0 3 | fn square(upto: Int, callback: Unit) { 4 | for (n = 0, n < upto, n++) { 5 | square_result = n * n 6 | ~callback 7 | } 8 | } 9 | 10 | let callback = { println(n + " squared is " + square_result) } 11 | square(5, callback) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/flowcheck.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "src/main/resources/fnHello" 3 | ) 4 | let obj = new fnHello() 5 | obj.hello() 6 | println("meow") -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/fnHello.eia: -------------------------------------------------------------------------------- 1 | fn hello() { 2 | return "hello world" 3 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/hello.eia: -------------------------------------------------------------------------------- 1 | let a = 1 2 | let square = 0 3 | until ((square = a * 3) != 9) { 4 | fout(a) 5 | a++ 6 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/invoketest.eia: -------------------------------------------------------------------------------- 1 | stdlib(math) 2 | 3 | println(math.max(5, 7)) 4 | println(math.min(5, 7)) 5 | println(math.avg(~{5 7 3 5 2 5})) 6 | -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/kitabreaktest.eia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/Eia64/src/main/resources/kitabreaktest.eia -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/listdeclarationtest.eia: -------------------------------------------------------------------------------- 1 | let names = ["melon", "ekita", shado(x, y) {x * y * x}] 2 | println(names) 3 | itr (name in names) { 4 | println("Who: " + name) 5 | } 6 | ; calling a shado function stored inside an array list 7 | println(names[2](5, 2)) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/looping.eia: -------------------------------------------------------------------------------- 1 | for (var x = 0, x < 5, x++) { 2 | println(format("X is %d", x)) 3 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/loops.eia: -------------------------------------------------------------------------------- 1 | itr (x: 1 to 20) { } 2 | itr (y: 20 to 1 by 2) { } 3 | for (let x = 0, i < 5, i++) { } 4 | 5 | let text = "hello" 6 | itr (c in text) { } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/looptesting.eia: -------------------------------------------------------------------------------- 1 | for (var i = 0, i < 5, i++) { 2 | if (i == 2) { 3 | continue 4 | } 5 | if (i == 4) break 6 | println(i) 7 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/miw.eia: -------------------------------------------------------------------------------- 1 | itr (x: 10 to 30 by 5) { 2 | println(x) 3 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/preparesetest/verify.eia: -------------------------------------------------------------------------------- 1 | fn indexOf(self: Array, element: Any) { 2 | let upto = len(self) 3 | for (var i = 0, i < upto, i++) 4 | if (self[i] == element) return i 5 | return -1 6 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/randomizationtest.eia: -------------------------------------------------------------------------------- 1 | let printRandomNum: Unit = { 2 | let n = rand(0, 9999) 3 | println("A random number: " + n) 4 | } 5 | ~printRandomNum 6 | ~printRandomNum -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/stdlibtest.eia: -------------------------------------------------------------------------------- 1 | stdlib(string) 2 | 3 | println("hello".indexOf("llo")) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/strings.eia: -------------------------------------------------------------------------------- 1 | let text = "hello world" 2 | let size = len(text) 3 | let i = 0 4 | 5 | until (i != size) { 6 | fout(text[i++]) 7 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/trytobreak.eia: -------------------------------------------------------------------------------- 1 | fn testReturn() { 2 | if (true) { 3 | 0 4 | if (true) { 5 | 0 6 | 0 7 | 0 8 | return true 9 | } 10 | } 11 | return false 12 | } 13 | 14 | println("It is true: " + testReturn()) 15 | 16 | fn sort(ints: Array) { 17 | let n = len(ints) - 1 18 | var x = 0 19 | var swapped = false 20 | for (var i = 0, i < n, i++) { 21 | swapped = false 22 | for (var j = 0, j < n - i, j++) { 23 | if (ints[j] > ints[j + 1]) { 24 | let temp = ints[j] 25 | ints[j] = ints[j + 1] 26 | ints[j + 1] = temp 27 | println("j: " + (j + 1)) 28 | swapped = true 29 | x++ 30 | } 31 | } 32 | if (!swapped) break 33 | } 34 | println(x) 35 | } 36 | 37 | let nums = ~{ 2 4 5 3 5 5 3 5 3 } 38 | sort(nums) 39 | println(nums) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/types.eia: -------------------------------------------------------------------------------- 1 | let objs = ~{{ "this can be evaluated" "or is it?" }} 2 | 3 | println( ~objs ) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/usesymbol.eia: -------------------------------------------------------------------------------- 1 | let a = 50 2 | let b = 5 3 | 4 | let max = if (a < b) { 5 | println("Choose A") 6 | := a 7 | } else { 8 | println("Choose B") 9 | := if (a == 50) { 10 | println("Oh its 50!") 11 | := 2 12 | } else a 13 | } 14 | 15 | println("Max: " + max) -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/whenstatements.eia: -------------------------------------------------------------------------------- 1 | when (10) { 2 | 2 -> { println("Two!") } 3 | (5 * 2) -> { println("Damn its 10!") } 4 | else -> { } 5 | } -------------------------------------------------------------------------------- /languages/Eia64/src/main/resources/wraptest.eia: -------------------------------------------------------------------------------- 1 | fn fib(n: Int) = if (n < 2) n else fib(n - 1) + fib(n - 2) 2 | println(fib(30) == 832040) -------------------------------------------------------------------------------- /languages/Eia64/stdlib/README.md: -------------------------------------------------------------------------------- 1 | # What is this? 2 | 3 | This is a standard library written in Eia64 👀 4 | 5 | ## How to use them? 6 | 7 | It's simple! 8 | 9 | ```` 10 | stdlib(string, math..) 11 | ```` -------------------------------------------------------------------------------- /languages/Eia64/stdlib/eint.eia: -------------------------------------------------------------------------------- 1 | visible fn pow(self: Int, power: Int): Int { 2 | power = copy(power) - 1 3 | self = copy(self) 4 | 5 | var result = self 6 | for (var i = 0, i < power, i++) { 7 | result *= self 8 | } 9 | return result 10 | } 11 | 12 | visible fn root(number: Int): Int { 13 | if (number < 0) { 14 | throw "Cannot find the square root of a negative number." 15 | } 16 | 17 | if (number == 0 || number == 1) { 18 | return number 19 | } 20 | 21 | var start = 1 22 | var end = number 23 | var result = 0 24 | 25 | until (start <= end) { 26 | var mid = (start + end) / 2 27 | 28 | if (mid * mid == number) { 29 | return mid 30 | } 31 | 32 | if (mid * mid < number) { 33 | start = mid + 1 34 | result = mid 35 | } else { 36 | end = mid - 1 37 | } 38 | } 39 | 40 | return result 41 | } 42 | 43 | visible fn mag(self: Int): Int { 44 | self = copy(self) 45 | if (0 > self) return -self 46 | return self 47 | } -------------------------------------------------------------------------------- /languages/Eia64/stdlib/etype.eia: -------------------------------------------------------------------------------- 1 | visible fn isStdLib(self: Type): Bool = 2 | self == type::String || self == type::Char 3 | || self == type::Int || self == type::Nil 4 | || type::Array -------------------------------------------------------------------------------- /languages/Eia64/stdlib/math.eia: -------------------------------------------------------------------------------- 1 | visible fn min(a: Int, b: Int): Int = if (a <= b) a else b 2 | visible fn max(a: Int, b: Int): Int = if (a >= b) a else b 3 | 4 | visible fn abs(a: Int): Int = if (a < 0) -a else a 5 | 6 | visible fn avg(nums: Array): Int { 7 | var sum = 0 8 | for (num in nums) { 9 | sum += num 10 | } 11 | return sum / len(nums) 12 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/AccessingPerson.eia: -------------------------------------------------------------------------------- 1 | include("imaginations/Person") 2 | 3 | let person = new Person("Melon", 16) 4 | person.printUser() 5 | println(person.age) 6 | 7 | println(person) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/HelloWorld.eia: -------------------------------------------------------------------------------- 1 | fn main(): Int { 2 | println("Hello, World!") 3 | return 0 4 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/Person.eia: -------------------------------------------------------------------------------- 1 | visible var person: String = nil 2 | visible var age: Int = nil 3 | 4 | visible fn init(name: String) { 5 | person = name 6 | age = 20 ; default age 7 | } 8 | 9 | visible fn init(name: String, _age: Int) { 10 | person = name 11 | age = _age 12 | } 13 | 14 | visible fn printUser() { 15 | println(format("Person named %s of age %d", person, age)) 16 | } 17 | 18 | visible fn string(): String { 19 | return "Person(name=" + person + ", age=" + age + ")" 20 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/arrayexpectation.eia: -------------------------------------------------------------------------------- 1 | ; to meet expectations documented in eia-docs 2 | 3 | ; array of 4 | println(arrayOf(5, 4)) 5 | println(arrayOf(5, 4)) 6 | println(makeArray(5, 3)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/doublebypasscheck.eia: -------------------------------------------------------------------------------- 1 | include(static:std:string) 2 | 3 | ; trying to replicate isNumeric() function behaviour to analysize signature verification bypass 4 | 5 | ; proxy for debugging 6 | visible fn contains(self: String, piece: String): Bool = self.contains(piece) 7 | 8 | visible fn isNumeric(self: String): Bool { 9 | var trimmed = self.trim() 10 | var size = len(trimmed) 11 | 12 | if (size == 0) return false 13 | 14 | var hasDigits = false 15 | var hasDecimalPoint = false 16 | 17 | for (var i = 0, i < size, i++) { 18 | let c = trimmed[i] 19 | println(typeOf(c)) 20 | contains("0123456789", c) 21 | if (c == '-' || c == '+' && i == 0) { 22 | continue 23 | } else if (contains("0123456789", c)) { 24 | hasDigits = true 25 | } else if (c == '.' && !hasDecimalPoint) { 26 | hasDecimalPoint = true 27 | } else { 28 | return false 29 | } 30 | } 31 | return hasDigits 32 | } 33 | 34 | isNumeric("aa") -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/dualreferencing.eia: -------------------------------------------------------------------------------- 1 | ; testing conditions that could cause program breaks, this time its two bi referencing functions 2 | 3 | fn meow() { 4 | boww() 5 | } 6 | 7 | fn boww() { 8 | meow() 9 | } 10 | 11 | ; only SO can break it 12 | meow() -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/fnsignaturebypass.eia: -------------------------------------------------------------------------------- 1 | fn meow(text: String) { 2 | println(text) 3 | } 4 | 5 | fn doMeow() { 6 | let astring = "meow" 7 | meow(astring[0]) 8 | } 9 | 10 | doMeow() -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/loadtest.eia: -------------------------------------------------------------------------------- 1 | include("imaginations/overload") 2 | 3 | let load = new overload(2, 3) 4 | println(load) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/overload.eia: -------------------------------------------------------------------------------- 1 | visible fn init(a: Int) { 2 | println(a) 3 | } 4 | 5 | visible fn init(a: Int, b: Int) { 6 | println(a, b) 7 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/plan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/Eia64/testfiles/imaginations/plan.jpg -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/simplifiedaccess.eia: -------------------------------------------------------------------------------- 1 | fn meow(first: String, second: String): Bool = true 2 | 3 | fn boww() { 4 | for (var i = 0, i < 1, i++) { 5 | meow("meow"[0], "a") 6 | } 7 | } 8 | 9 | boww() -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/someretestingofsyntax: -------------------------------------------------------------------------------- 1 | let x = 5 2 | let y = 8 3 | 4 | ; static refactor of code snippers 5 | 6 | if (x > y) { 7 | println("X is greater") 8 | } else { 9 | println("Y is greater") 10 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/trickyfloatparse.eia: -------------------------------------------------------------------------------- 1 | ; testing the lexer 2 | 3 | println(.5) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/imaginations/trycatchtesting.eia: -------------------------------------------------------------------------------- 1 | try { 2 | throw "meow" 3 | } catch message { 4 | println(message) 5 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/Boww.eia: -------------------------------------------------------------------------------- 1 | fn bark() { 2 | println("Bark") 3 | } 4 | 5 | fn string(): String { 6 | return "This is a dog" 7 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/Cat.eia: -------------------------------------------------------------------------------- 1 | fn string(): String { 2 | return "This is a cat" 3 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/DependencyA.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/Module" 3 | ) 4 | 5 | var module: Any = "" 6 | 7 | fn init(name: String) { 8 | module = new Module(name) 9 | } 10 | 11 | fn string(): String { 12 | return "DependencyA(" + module::Module.moduleName + ")" 13 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/DiamondCast: -------------------------------------------------------------------------------- 1 | let x: Any = "Hello, World!" 2 | println(x::String) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/ExampleClass.eia: -------------------------------------------------------------------------------- 1 | var name = "" 2 | 3 | fn init(_name: String) { 4 | ; lets see how it behaves while overclass calling 5 | println(_name) 6 | println(type(_name)) 7 | name = _name 8 | } 9 | 10 | fn someFunction(x: Int, y: Int) { 11 | println() 12 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/ExtentiveObj.eia: -------------------------------------------------------------------------------- 1 | fn string(): String { 2 | return "This is an extensive object (wrapped upon objet)" 3 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/ExternalA.eia: -------------------------------------------------------------------------------- 1 | var name = "" 2 | 3 | fn init(_name: String) { 4 | name = _name 5 | } 6 | 7 | fn string(): String { 8 | return "ExternalA(" + name + ")" 9 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/Girl.eia: -------------------------------------------------------------------------------- 1 | let girlName = "" 2 | 3 | fn init(name: String) { 4 | girlName = name 5 | } 6 | 7 | fn getName() = girlName 8 | 9 | fn string() = "Girl(" + girlName + ")" -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/Man.eia: -------------------------------------------------------------------------------- 1 | let manName = "" 2 | 3 | fn init(name: String) { 4 | manName = name 5 | } 6 | 7 | fn getName() = manName 8 | 9 | fn string() = "Man(" + manName + ")" -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/Module.eia: -------------------------------------------------------------------------------- 1 | var moduleName = "" 2 | 3 | fn init(name: String) { 4 | moduleName = name 5 | } 6 | 7 | fn string(): String { 8 | return "Module(" + moduleName + ")" 9 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/Need.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/DependencyA" 3 | ) 4 | 5 | ; this should not be actually allowed 6 | ; this happens because Dependency A -> depends on Module A 7 | let module = new Module("Meow") 8 | println(module) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/NullA.eia: -------------------------------------------------------------------------------- 1 | fn string(): String { 2 | return "This is Null A" 3 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/NullB.eia: -------------------------------------------------------------------------------- 1 | fn string(): String { 2 | return "This is Null B" 3 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/ObjectExample.eia: -------------------------------------------------------------------------------- 1 | var aValue = 0 2 | 3 | fn init(value: Int) { 4 | aValue = value 5 | } 6 | 7 | fn string(): String { 8 | return "Obj(" + aValue + ")" 9 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/One.eia: -------------------------------------------------------------------------------- 1 | fn testAdd(a: Int, b: Int): Int = a + b 2 | 3 | fn string() { 4 | return "One" 5 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/Person.eia: -------------------------------------------------------------------------------- 1 | let personName = "" 2 | 3 | fn init(name: String) { 4 | personName = name 5 | } 6 | 7 | fn getName() { 8 | println("getName() was called") 9 | return personName 10 | } 11 | -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/PersonDetails.eia: -------------------------------------------------------------------------------- 1 | var personName = "" 2 | var personAge = 0 3 | 4 | fn init(name: String, age: Int) { 5 | personName = name 6 | personAge = age 7 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/SimpleA.eia: -------------------------------------------------------------------------------- 1 | fn init() { 2 | ; println("Simple A was created ") 3 | print("") 4 | } 5 | 6 | fn string(): String { 7 | return "SimpleA" 8 | } 9 | -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/SimpleB.eia: -------------------------------------------------------------------------------- 1 | fn init() { 2 | ; println("Simple B was created ") 3 | print("") 4 | } 5 | 6 | fn string(): String { 7 | return "SimpleB" 8 | } 9 | -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/SimpleElement.eia: -------------------------------------------------------------------------------- 1 | var aValue = "" 2 | 3 | fn init(value: String) { 4 | aValue = value 5 | } 6 | 7 | fn string(): String { 8 | return "Element(" + aValue + ")" 9 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/SimpleObject.eia: -------------------------------------------------------------------------------- 1 | var value = "" 2 | 3 | fn init(_value: String) { 4 | value = _value 5 | } 6 | 7 | fn getValue(): String = value 8 | 9 | fn string(): String { 10 | return "SimpleObject(" + value + ")" 11 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/ValueClass.eia: -------------------------------------------------------------------------------- 1 | var personName = "" 2 | 3 | fn init(name: String) { 4 | personName = name 5 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/anytoonecast.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/One" 3 | ) 4 | 5 | let one: Object = new One() 6 | let oneAgain: One = one::One 7 | println(one) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/arraydecltests.eia: -------------------------------------------------------------------------------- 1 | ; direct auto declaration using [ ] 2 | 3 | let names = ["India", "Japan", "Russia"] 4 | let otherSet = array(5, 2, 2) 5 | let otherSet2 = array(5, 2, 2) 6 | 7 | println(type(names)) 8 | println(type(otherSet)) 9 | println(type(otherSet) == type(otherSet2)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/arrayparametertesting.eia: -------------------------------------------------------------------------------- 1 | fn printPlaces(places: Array) { 2 | each (place in places) { 3 | println(place) 4 | } 5 | } 6 | 7 | let places = arrayOf("Japan", "India", "Russia", "UAE") 8 | printPlaces(places) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/arrayreferencetest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/SimpleObject" 3 | ) 4 | 5 | let names = arrayOf( 6 | new SimpleObject("melon"), 7 | new SimpleObject("ekita"), 8 | new SimpleObject("meow")) 9 | 10 | let first = names[0] 11 | println("First: " + first) 12 | 13 | names[0] = names[1] 14 | println(names[0]) 15 | println("First: " + first) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/arraysigbreak.eia: -------------------------------------------------------------------------------- 1 | let strings = arrayOf(2, "meow") 2 | strings[0] = 123 3 | println(strings) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/autoint.eia: -------------------------------------------------------------------------------- 1 | println('B' > 'A') 2 | println('B' > 65) 3 | println(int('B')) 4 | println(char('B' + 1) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/bodysigntest.eia: -------------------------------------------------------------------------------- 1 | fn plus(a: Int, b: Int): Int { 2 | if (a == b) { 3 | ; conflict of signatures promised vs given 4 | return "meow" 5 | } 6 | return a + b 7 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/breakingsyntax.eia: -------------------------------------------------------------------------------- 1 | let x = 123 2 | (if (x == 5) println("hello world") else println("meow world")) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/comparisionsupport.eia: -------------------------------------------------------------------------------- 1 | ; right now logical magnitude comparison is only limited to Int 2 | ; but we have to extend support for other data types like char 3 | 4 | ;println('B' > 'A') 5 | println(int('B') > int('A')) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/converioncheck.eia: -------------------------------------------------------------------------------- 1 | println(int('A')) 2 | println(char(65)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/debugstringlex.eia: -------------------------------------------------------------------------------- 1 | println( 2 | "hello \" how are you \"" 3 | ) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/declarativematch.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/Man", 3 | "simulationenv/Girl" 4 | ) 5 | 6 | ; if we do not handle it by depth, it will just pass through 7 | let a: Girl = new Man("Miaw") 8 | print(a) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/deflattentest.eia: -------------------------------------------------------------------------------- 1 | include("simulationenv/Person") 2 | 3 | let x = new Person("Melon") 4 | let y = new Person("Ekita") 5 | 6 | let name = (if (true) x else y).getName() 7 | println("Name is " + name) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/diamongparsing.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:string 3 | ) 4 | 5 | let name: Any = "Ekita" 6 | println(name::String.contains("kita")) 7 | 8 | ; casting a value received from a function 9 | fn getValue(value: Any) = value 10 | println(getValue("hello")::String.contains("meow")) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/dynamicarrayclasstest.eia: -------------------------------------------------------------------------------- 1 | let integers: Array = arrayOf(5, 10) 2 | println(integers) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/dynamicobjfalsecast.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/Cat", 3 | "simulationenv/Boww" 4 | ) 5 | 6 | let aCat: Any = new Cat() 7 | println(aCat::Boww.bark()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/exacttypetest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/Man", 3 | "simulationenv/Girl" 4 | ) 5 | 6 | ; when we do not check the types deeply, it would be possible to pass a 'Girl' type to a man 7 | ; so a parser time verification is required to solve this 8 | 9 | 10 | fn accept(man: Man) { 11 | println(man) 12 | } 13 | 14 | ; after verifying the runtime type, we shall also need to verify the subtype of Object 15 | accept(new Girl("Meow")) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/extensiontoprimitiveobj.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/ExtentiveObj" 3 | ) 4 | 5 | fn operateObject(obj: Object) { 6 | println(obj) 7 | } 8 | 9 | let wrappedObject = new ExtentiveObj() 10 | operateObject(wrappedObject) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/fakecasttest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:string 3 | ) 4 | 5 | let x: Any = 5 6 | println(x::String.trim()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/falseobjextension.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/NullA", 3 | "simulationenv/NullB" 4 | ) 5 | 6 | fn processA(a: NullA) { 7 | println(a) 8 | } 9 | 10 | processA(new NullB()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/fnargverification.eia: -------------------------------------------------------------------------------- 1 | fn printAny(any: Any) { 2 | println(any) 3 | } 4 | printAny("Hello, World!") -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/fncustomarg.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/Person" 3 | ) 4 | 5 | fn hello(person: Person) { 6 | println("Hello " + person.getName()) 7 | } 8 | 9 | hello(new Person("Melon")) 10 | 11 | let miaw(p: Person) { 12 | println(p) 13 | } 14 | miaw("Ekita") -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/fnsignaturematch.eia: -------------------------------------------------------------------------------- 1 | fn plus(first: Int, second: Int) { 2 | println(first + second) 3 | } 4 | 5 | plus(1, 2) 6 | plus("1", "2") -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/fnvoidtest.eia: -------------------------------------------------------------------------------- 1 | fn hello() { 2 | println("This is a void function") 3 | } 4 | ; should be caught by pre execution parser 5 | let x = hello() 6 | println(x) 7 | println(type(x)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/functionoverloadingbehaviour.eia: -------------------------------------------------------------------------------- 1 | fn meow(name: String) { 2 | println(format("Meow %s!", name)) 3 | } 4 | 5 | fn meow(name: String, mi: String) { 6 | println("Mi " + mi) 7 | println(format("Meow %s!", name)) 8 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/functionselfreferencingtest.eia: -------------------------------------------------------------------------------- 1 | ; function sub() references itself, so when it 2 | ; comes to resolution of return type, type ANY is picked 3 | fn sub(n: Int) = 4 | if (n == 0) 0 else sub(n - 1) 5 | println(sub(1)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/hello.eia: -------------------------------------------------------------------------------- 1 | fn sayHello(): String { 2 | return "Hello, World!" 3 | } 4 | 5 | fn sayTrue(): Bool = true -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/ifimagination.eia: -------------------------------------------------------------------------------- 1 | let name = "melon" 2 | 3 | name == "meow" -> { 4 | println("Yep name is meow") 5 | } ?: { 6 | printn("Name is not meow!") 7 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/ifsimulate.eia: -------------------------------------------------------------------------------- 1 | let a: Any = 10 2 | if (true) 7 else 2 * a::Int 3 | 4 | fn execute(node: Array) { 5 | var left: Any = node[0] 6 | let op = node[1]::String 7 | var right: Any = node[2] 8 | 9 | if (type(left) == "e_array") left = execute(left) 10 | if (type(right) == "e_array") right = execute(right) 11 | 12 | left = int(left) 13 | right = int(right) 14 | 15 | return if (op == PLUS) left::Int + right::Int 16 | else if (op == MINUS) left::Int - right::Int 17 | else if (op == MULTIPLY) left::Int * right::Int 18 | else if (op == DIVIDE) left::Int / right::Int 19 | else { 20 | println("Unknown operator code: " + op) 21 | exit(1) 22 | } 23 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/importedcasting.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/Person" 3 | ) 4 | 5 | let melon: Any = new Person("Melon") 6 | 7 | println(melon::Person.getName()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/includetest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/hello" 3 | ) 4 | 5 | let x = new hello() 6 | if ((x.sayTrue())) { 7 | println("Hello, World!") 8 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/interruptflowcheck.eia: -------------------------------------------------------------------------------- 1 | if (true) { 2 | println("meow world") 3 | return 2 4 | } 5 | return 7 + 3 -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/interruptioncheck.eia: -------------------------------------------------------------------------------- 1 | let x = 5 2 | let y = 10 / 2 3 | 4 | if (x == y) { 5 | ; this would error out, since we are not in a for type loop 6 | ; this statement is not allowed here 7 | break 8 | println("Miaw") 9 | } 10 | println("World") -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/intparsetest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:string 3 | ) 4 | 5 | let aNumber = "-123" 6 | println(aNumber.toInt()) 7 | 8 | let bNumber = "123456" 9 | println(bNumber.toInt() == 123456) 10 | 11 | let cNumber = "+789" 12 | println(cNumber.toInt() == 789) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/istesting.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/ExternalA" 3 | ) 4 | 5 | println("meow" is String) 6 | println(7 + 3 + "meow" is String) 7 | 8 | let x: Any = "meow" 9 | println(x is String) 10 | 11 | let ea: Any = new ExternalA("meow") 12 | println(ea is ExternalA) 13 | 14 | let a = arrayOf("meow", "kat") 15 | println(a is Array) 16 | println(a is Array) 17 | 18 | println(type(ea)) 19 | println(type(ea) == "e_object") 20 | println(type(a)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/lexertest.eia: -------------------------------------------------------------------------------- 1 | let name = "Ekita" 2 | println("Hello $name!") 3 | println(format("Hello %s!", name)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/listtest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "stdlib/list" 3 | ) 4 | 5 | let names = new list(1) 6 | names.add("melon") 7 | names.add("ekita") 8 | 9 | println(names.size() == 2) 10 | println(names.string()) 11 | names.remove(0) 12 | names.add("meow") 13 | names.addAt("miw", 1) 14 | println("current: " + names.string()) 15 | println(names.get(0) == "ekita") 16 | println(names.get(1) == "miw") 17 | names.set("miww", 2) 18 | println(names.get(2) == "miww") 19 | println() 20 | println(names.string()) 21 | ; this should error out 22 | names.get(7) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/loopcheck.eia: -------------------------------------------------------------------------------- 1 | for (var i = 0, i < 73, i++) { 2 | // need to implement char() method for int -> char translation 3 | println(char(i)) 4 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/nestedreturnstmttesting.eia: -------------------------------------------------------------------------------- 1 | fn sayHello(name: String): String { 2 | fn greet(): String { 3 | println("Hello " + name) 4 | return "miw" 5 | } 6 | println("Meow") 7 | return greet() 8 | } 9 | println(sayHello("Melon")) 10 | println(type(sayHello("Melon"))) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/newarraytesting.eia: -------------------------------------------------------------------------------- 1 | let names = arrayOf(5, "hello") 2 | println(names) 3 | names[0] = "meow" 4 | println(names) 5 | -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/objcast.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/Person" 3 | ) 4 | 5 | let anObject: Object = new Person("Ekita") 6 | println(type(anObject)) 7 | println(anObject::Person.getName()) 8 | -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/objectarraytesting.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/SimpleElement" 3 | ) 4 | 5 | let elements = arrayOf(2, new SimpleElement("Meow")) 6 | println(elements) 7 | elements[0] = new SimpleElement("Boww") 8 | println(elements) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/objectcreationbenchmark.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/ObjectExample", 3 | static:std:string 4 | ) 5 | 6 | let startTime = time() 7 | 8 | for (var i = 0, i < 1000, i++) { 9 | println(new ObjectExample(i)) 10 | } 11 | 12 | println("Result: " + format(" took %d ms", time() - startTime)) 13 | 14 | let startTime1 = time() 15 | for (var i = 0, i < 100, i++) { 16 | println(("" + i).length()) 17 | } 18 | println("Result Last: " + format(" took %d ms", time() - startTime1)) 19 | -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/objparmmismatchtest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/SimpleA", 3 | "simulationenv/SimpleB" 4 | ) 5 | 6 | fn aFunction(simpleA: SimpleA) { 7 | ; here is where we f up, intention was to receive simpleA, but we got simpleB 8 | println(simpleA) 9 | } 10 | 11 | aFunction(new SimpleB()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/operationtesting.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:array 3 | ) 4 | 5 | let PLUS = "+" 6 | let MINUS = "-" 7 | let DIVIDE = "/" 8 | let MULTIPLY = "*" 9 | 10 | let SUPPORTED_OPERATORS = arrayOf(PLUS, MINUS, DIVIDE, MULTIPLY) 11 | 12 | println(SUPPORTED_OPERATORS[0] == PLUS) 13 | 14 | println(SUPPORTED_OPERATORS.size()) 15 | println(SUPPORTED_OPERATORS.contains("+")) 16 | println(SUPPORTED_OPERATORS.contains("-")) 17 | println(SUPPORTED_OPERATORS.contains("/")) 18 | println(SUPPORTED_OPERATORS.contains("*")) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/otherflowtest.eia: -------------------------------------------------------------------------------- 1 | fn loop(from: Int, till: Int): Int { 2 | for (var i = from, i < till, i++) { 3 | println(i) 4 | if (i == 2) return "hello world" 5 | } 6 | return 0 7 | } 8 | 9 | println(loop(0, 7)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/overclasstest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/ExampleClass" 3 | ) 4 | 5 | let anInstance = new ExampleClass(7 + 3) 6 | println(anInstance) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/propertyaccess.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/PersonDetails" 3 | ) 4 | 5 | let details = new PersonDetails("Melon", 16) 6 | println(details.personName) 7 | println(details.personAge) 8 | 9 | println(type(details.personName)) 10 | println(type(details.personAge)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/provoke.eia: -------------------------------------------------------------------------------- 1 | include("simulationenv/Person") 2 | 3 | let x = new Person("First") 4 | let y = new Person("Second") 5 | 6 | let name = (if (false) x else y).getName() 7 | println("Invokcation Of" + name) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/recursiontesting.eia: -------------------------------------------------------------------------------- 1 | fn factorial(n: Int): Int = 2 | if (n <= 1) 1 3 | else n * factorial(n - 1) 4 | 5 | for (var i = 1, i < 11, i++) { 6 | println(factorial(i)) 7 | } 8 | 9 | fn root(number: Int) { 10 | if (number < 0) { 11 | throw "Cannot find the square root of a negative number." 12 | } 13 | 14 | if (number == 0 || number == 1) { 15 | return number 16 | } 17 | 18 | var start = 1 19 | var end = number 20 | var result = 0 21 | 22 | until (start <= end) { 23 | var mid = (start + end) / 2 24 | 25 | if (mid * mid == number) { 26 | return mid 27 | } 28 | 29 | if (mid * mid < number) { 30 | start = mid + 1 31 | result = mid 32 | } else { 33 | end = mid - 1 34 | } 35 | } 36 | 37 | return result 38 | } 39 | 40 | 41 | println(root(626)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/recursiveflowtest.eia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/Eia64/testfiles/simulationenv/recursiveflowtest.eia -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/returnmetatesting.eia: -------------------------------------------------------------------------------- 1 | fn meow(a: Bool): Int { 2 | if (a) { 3 | return 1 4 | } else { 5 | return 2 6 | } 7 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/secondfunctionoverloadingtest.eia: -------------------------------------------------------------------------------- 1 | fn printUser(name: String) { 2 | println("Username: " + name) 3 | } 4 | 5 | fn printUser(name: String, age: Int) { 6 | println(format("Username: %s, age: %d", name, age)) 7 | } 8 | 9 | printUser("Meow") 10 | printUser("Melon", 16) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/secondobjarrtest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/SimpleElement" 3 | ) 4 | 5 | let elements = arrayOf(2, new SimpleElement("Meow")) 6 | println(elements) 7 | 8 | ; element testing for 9 | elements[0] = new SimpleElement("Boww") 10 | elements[1] = new SimpleElement("Boww") 11 | elements[2] = new SimpleElement("Boww") 12 | elements[3] = new SimpleElement("Boww") 13 | println(elements) 14 | 15 | for (var i = 0, i < 100, i++) { 16 | println(new SimpleElement(str(i))) 17 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/secondsignaturefullfilltest.eia: -------------------------------------------------------------------------------- 1 | let abcd: Int = if (true) { 2 | println("meow") 3 | 7 + 3 4 | } else { 5 | ; println returns number of elements printed 6 | println("meoww") 7 | } 8 | println("abcd is " + abcd) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/secondsimulation.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/Man", 3 | "simulationenv/Girl" 4 | ) 5 | 6 | let a: Girl = new Man("Miaw") 7 | let b: Girl = new Man("Miaw1") 8 | let c: Girl = new Man("Miaw2") 9 | 10 | print(a, b, c) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/shadoargs.eia: -------------------------------------------------------------------------------- 1 | let sayHello(name: String) { 2 | println(format("Hello %s!", name)) 3 | } 4 | 5 | let x = 123 6 | sayHello(x) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/signaturefullfilltest.eia: -------------------------------------------------------------------------------- 1 | let a: Int = if (true) { 2 | println("meow") 3 | 7 + 3 4 | } 5 | println("a is " + a) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/simpleimport.eia: -------------------------------------------------------------------------------- 1 | include(static:"simulationenv/Person") 2 | println(Person.getName()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/standardizingforloop.eia: -------------------------------------------------------------------------------- 1 | let places = arrayOf("Japan", "India", "Germany") 2 | 3 | for (place in places) { 4 | println(place) 5 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/stringincltest.eia: -------------------------------------------------------------------------------- 1 | include(static:std:string) 2 | 3 | ; then we need to do recursive testing 4 | -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/terminativeflowcheck.eia: -------------------------------------------------------------------------------- 1 | fn plus(a: Int, b: Int): Int { 2 | if (a == b) { 3 | return a * b 4 | } 5 | return a + b 6 | } 7 | println(plus(1, 2)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/terminativeiftesting.eia: -------------------------------------------------------------------------------- 1 | fn hello(meow: Bool) { 2 | if (meow) { 3 | println("Its a meow") 4 | return 0 5 | } 6 | return 2 7 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/test.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/hello" 3 | ) 4 | 5 | let x: hello = new hello() 6 | let y = x 7 | let z: String = y.sayHello() 8 | println(z) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/test2.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:eint 3 | ) 4 | 5 | let x: Int = 25 6 | let y = x 7 | println(x.root()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/trimmetest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:string 3 | ) 4 | 5 | let myString = "Hello".trim() 6 | println(myString) 7 | 8 | fn trim(self: String): String { 9 | let copySelf = copy(self) 10 | until (startsWith(copySelf, " ") 11 | || startsWith(copySelf, "\t") 12 | || startsWith(copySelf, "\n")) { 13 | copySelf = substring(copySelf, 1) 14 | } 15 | until (endsWith(copySelf, " ") 16 | || endsWith(copySelf, "\t") 17 | || endsWith(copySelf, "\n")) { 18 | copySelf = substring(copySelf, 1) 19 | } 20 | return copySelf 21 | } 22 | 23 | ; general redefinition testing 24 | fn endsWith(self: String, suffix: String): Bool { 25 | let selfSize = len(self) 26 | let suffixSize = len(suffix) 27 | 28 | if (suffixSize > selfSize) 29 | return false 30 | 31 | let selfLastIndex = selfSize - 1 32 | let suffixLastIndex = suffixSize - 1 33 | 34 | for (var i = suffixLastIndex, i >= 0, i--) 35 | if (suffix[i] != self[selfLastIndex--]) 36 | return false 37 | return true 38 | } 39 | 40 | fn hello(person: Person) { 41 | println("Hello " + person.getName()) 42 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/unitexprtesting.eia: -------------------------------------------------------------------------------- 1 | let x = { println(1) } 2 | x() -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/valuevariableaccess.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "simulationenv/ValueClass" 3 | ) 4 | 5 | let value = new ValueClass("Meow") 6 | println(value.personName) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/simulationenv/voidarraytest.eia: -------------------------------------------------------------------------------- 1 | fn nothing() { 2 | ; this does nothing 3 | } 4 | 5 | let a = arrayOf(nothing(), nothing(), nothing()) 6 | println(a) 7 | println(type(a[0])) 8 | println(a[0] == 0) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/Secondary.eia: -------------------------------------------------------------------------------- 1 | var moduleName = "" 2 | 3 | fn init(name: String) { 4 | moduleName = name 5 | } 6 | 7 | fn string(): String { 8 | return "Module(" + moduleName + ")" 9 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/aFloat.eia: -------------------------------------------------------------------------------- 1 | let value = 25.5 2 | println(value) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/additionalstringtest.eia: -------------------------------------------------------------------------------- 1 | include(static:std:string) 2 | 3 | ; bug where if the spaces are towards right, it deletes the character itself 4 | println("2 ".trim()) 5 | println(" 2 ".trim()) 6 | println(" 2 ".trim()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/advanced_recursion_test.eia: -------------------------------------------------------------------------------- 1 | ; some really simple well known algorithms benchmarked mark for testing 2 | 3 | private fn fib(n: Int): Int { 4 | if (n <= 1) return n 5 | return fib(n - 1) + fib(n - 2) 6 | } 7 | 8 | private fn gcd(a: Int, b: Int): Int { 9 | if (b == 0) return a 10 | return gcd(b, a % b) ;; new feat for % remainder 11 | } 12 | 13 | var startTime = time() 14 | 15 | println( 16 | "Result fib: " + fib(2), 17 | format(" took %d ms", time() - startTime) 18 | ) 19 | 20 | startTime = time() 21 | 22 | println( 23 | "Result: gcd" + gcd(3, 90), 24 | format(" took %d ms", time() - startTime) 25 | ) 26 | -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/arraytest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:array 3 | ) 4 | 5 | let upper_case = arrayOf( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 6 | 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ) 7 | 8 | println(upper_case.contains('A')) 9 | println(!(upper_case.isEmpty())) 10 | 11 | println(upper_case[0]) 12 | println(type(upper_case[0]) == 'A') 13 | println(upper_case[0] = '5') 14 | println(upper_case[0]) 15 | 16 | println(upper_case = upper_case.add(9)) 17 | println(upper_case.removeAt(2)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/bool_parse_investigation.eia: -------------------------------------------------------------------------------- 1 | include(static:std:string) 2 | 3 | let value: Any = "Meow" 4 | println(!("Meow"::String.isEmpty())) 5 | 6 | private fn toTestBoolArray(array: Array): Array { 7 | let size = len(array) 8 | let numeric = makeArray(size, 0) 9 | for (var i = 0, i < size, i++) { 10 | numeric[i] = bool(array[i]) 11 | } 12 | return numeric 13 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/bugtest.eia: -------------------------------------------------------------------------------- 1 | fn robotChoose(user: String) { 2 | if (user == "rock") return "yes" 3 | return "no" 4 | } 5 | 6 | println(robotChoose("rock")) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/classimagination.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:etype 3 | ) 4 | 5 | 6 | let a = type::String 7 | println(a == type::String) 8 | 9 | let array = arrayOf("meow", "world") 10 | println(typeOf(array)) 11 | println(typeOf(array) == type::Array) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/explorationreview.eia: -------------------------------------------------------------------------------- 1 | ; exploration code review testing for eia docs demonstration 2 | fn pow(n: Int, power: Int, callback: Unit) { 3 | n = copy(n) - 1 ; do a copy to not change original value 4 | 5 | for (var i = 0, i < n, i++) { 6 | var powed = copy(i) 7 | for (var j = 1, j < power, j++) { 8 | powed *= i 9 | } 10 | callback(i, powed) 11 | } 12 | } 13 | let power = 2 14 | let callback(of: Int, powed: Int) { 15 | println(format("%d^%d is %d", of, power, powed)) 16 | } 17 | pow(5, power, callback) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/inttest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:eint 3 | ) 4 | println(25.pow(2)) 5 | for (var i = 0, i < 10, i++) { 6 | println(i + " squared: " + i.pow(2) + ", rooted " + i.root()) 7 | } 8 | println(25.root()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/isolatedandtesting.eia: -------------------------------------------------------------------------------- 1 | fn isEOF(): Bool { 2 | println("isEOF() was accessed") 3 | return false 4 | } 5 | fn peek(): String { 6 | println("peek() was accessed") 7 | return "123" 8 | } 9 | 10 | println(!isEOF() && peek() != ")") -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/listscheck.eia: -------------------------------------------------------------------------------- 1 | include(std:list) 2 | 3 | let names = new list(3) 4 | names.add("Hack") 5 | names.add("Club") 6 | 7 | println(names) 8 | println(names.toArray()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/listtest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:list 3 | ) 4 | 5 | let names = new list(50) 6 | names.add("meow") 7 | names.add("ekita") 8 | -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/mathtest.eia: -------------------------------------------------------------------------------- 1 | include(static:std:math) 2 | 3 | println(math.max(5, 2)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/numericchecktest.eia: -------------------------------------------------------------------------------- 1 | include(static:std:string) 2 | 3 | println("1233".isNumeric()) 4 | println("+12.33".isNumeric()) 5 | println("+12232.33".isNumeric()) 6 | println("-.33".isNumeric()) 7 | println("+0.33".isNumeric()) 8 | println("2.3233333333".isNumeric()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/numericsyntaxtest.eia: -------------------------------------------------------------------------------- 1 | println(1 - "a") 2 | println(13 + "a" * "a") 3 | println(1 / "a") -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/parseordertest.eia: -------------------------------------------------------------------------------- 1 | let a { 2 | println("a was accessed") 3 | := false 4 | } 5 | let b = { 6 | println("b was accessed") 7 | := true 8 | } 9 | println(a() && b()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/queuetesting.eia: -------------------------------------------------------------------------------- 1 | ; testing the PriorityQueue.eia standard library module 2 | 3 | include( 4 | std:string, 5 | "stdlib/structs/PriorityQueue", 6 | "stdlib/structs/PriorityElement" 7 | ) 8 | 9 | let queue = new PriorityQueue(5) 10 | queue.add(new PriorityElement("hi", 2)) 11 | queue.add(new PriorityElement("meow", 5)) 12 | 13 | println(queue) 14 | println(queue.poll()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/recreaterps.eia: -------------------------------------------------------------------------------- 1 | ; recreating small part of rock paper scissor to analyze edge conditions 2 | 3 | private fn robotChoose(user: String): Array { 4 | let choices = arrayOf("rock", "paper", "scissor") 5 | let robot = choices[rand(0, 2)] 6 | if (user == robot) return arrayOf(robot, 0) 7 | if ((user == "rock" && robot == "scissor") || (user == "paper" && robot == "rock") || (user == "scissor" && robot == "paper")) { 8 | return arrayOf(robot, 1) 9 | } 10 | 11 | return arrayOf(robot, 2) 12 | } 13 | 14 | 15 | for (var i = 0, i < 5, i++) { 16 | println(robotChoose("Rock")) 17 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/secondfloat.eia: -------------------------------------------------------------------------------- 1 | let value = 5.5 2 | let aFloat: Float = float(value) 3 | println(value) 4 | println(value + 7) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/simulate_parse_break.eia: -------------------------------------------------------------------------------- 1 | for (var i = 0, i < 5, i++) { 2 | var powed = copy(i) 3 | ; RM --> LV --> Final Parse Result 4 | for (var j = 1, j < 3, j++) { 5 | powed *= i 6 | } 7 | println(powed) 8 | } 9 | 10 | println(2 ** 64) 11 | println(2 ** (128) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/stringtest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:string 3 | ) 4 | 5 | println("hello".indexOfChar('l') == 2) 6 | println("hello".indexOf("llo") == 2) 7 | println("melon".contains("lon")) 8 | println("hello".startsWith("hel")) 9 | println("hello".endsWith("llo")) 10 | println("hello".uppercase() == "HELLO") 11 | println("HELLO".lowercase() == "hello") 12 | println("Kumaraswamy".substring(6) == "swamy") 13 | println("Kumaraswamy".part(3, 6) == "ara") 14 | println("1234".isNumeric()) 15 | println("-1234.23".isNumeric()) 16 | println(!("1234.-23".isNumeric())) 17 | println("mElOn".isAlpha()) 18 | println("aabbcc".replace("bbccc", "xx")) 19 | println("aabbcc".replace("bbcc", "xx")) 20 | println("k a t".splitOnce(" ")) 21 | println("k a t a ".split(" ") == arrayOf("k", "a", "t", "a", "")) 22 | println("HACKCLUB!".toCharArray()) 23 | println("Tab\tSpace\sNew Line\n\n") 24 | println("Cat".repeat(5)) 25 | println("Cat".reverse()) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/testmodule.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "vision/Secondary" 3 | ) 4 | 5 | var module: Any = "" 6 | 7 | fn init(name: String) { 8 | module = new Module(name) 9 | for (var i = 0, i < len(name), i++) { 10 | println(i) 11 | } 12 | } 13 | 14 | fn string(): String { 15 | return "DependencyA(" + module::Module.moduleName + ")" 16 | } -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/typetest.eia: -------------------------------------------------------------------------------- 1 | println(typeOf("Melon") == type::String) ; true 2 | println(typeOf(arrayOf(5, 2)) == type::Array) ; true -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/unittest.eia: -------------------------------------------------------------------------------- 1 | fn sub(value: Int) { 2 | return 3 | if (value == 0) 0 4 | else sub(value - 1) 5 | } 6 | println(sub(25)) -------------------------------------------------------------------------------- /languages/Eia64/testfiles/stdlibtest/when_expression_test: -------------------------------------------------------------------------------- 1 | let left = 2.4 2 | let right = 24.4 3 | let op = '+' 4 | 5 | let a = (when (op) { 6 | '+' -> { left::Float + right::Float } 7 | '-' -> { left::Float - right::Float } 8 | '*' -> { left::Float * right::Float } 9 | '/' -> { left::Float / right::Float } 10 | else -> { 11 | exit(1) 12 | } 13 | })::Float -------------------------------------------------------------------------------- /languages/Eia64/tests/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("java") 3 | kotlin("jvm") 4 | } 5 | 6 | group = "space.themelon.eia64" 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | mavenCentral() 11 | } 12 | 13 | dependencies { 14 | testImplementation(platform("org.junit:junit-bom:5.10.0")) 15 | testImplementation("org.junit.jupiter:junit-jupiter") 16 | implementation(kotlin("stdlib-jdk8")) 17 | } 18 | 19 | tasks.test { 20 | useJUnitPlatform() 21 | } 22 | kotlin { 23 | jvmToolchain(21) 24 | } -------------------------------------------------------------------------------- /languages/Eia64/tests/src/main/java/space/themelon/eia64/EiaLiveAlternative.kt: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64 2 | 3 | import java.util.* 4 | import java.util.concurrent.Executor 5 | 6 | object EiaLiveAlternative { 7 | @JvmStatic 8 | fun main(args: Array) { 9 | val scanner = Scanner(System.`in`) 10 | 11 | var buffer = StringJoiner("\n") 12 | while (true) { 13 | print("> ") 14 | val line = scanner.nextLine() 15 | if (line == "exit") break 16 | else if (line == "~~") { 17 | buffer = StringJoiner("\n") 18 | } 19 | else buffer.add(line) 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /languages/Eia64/tests/src/main/java/space/themelon/eia64/Main.java: -------------------------------------------------------------------------------- 1 | package space.themelon.eia64; 2 | 3 | public class Main { 4 | public static void main(String[] args) { 5 | System.out.println("Hello world!"); 6 | } 7 | } -------------------------------------------------------------------------------- /languages/Eia64/vision/ClassicPerson.eia: -------------------------------------------------------------------------------- 1 | var name = "" 2 | 3 | fn init(_name: String) { 4 | name = _name 5 | } 6 | 7 | fn string(): String { 8 | return "ClassicPerson(" + name + ")" 9 | } -------------------------------------------------------------------------------- /languages/Eia64/vision/Meow.eia: -------------------------------------------------------------------------------- 1 | private var name = "" 2 | 3 | fn init(_name: String) { 4 | name = _name 5 | } 6 | 7 | private fn doMeow() { 8 | println("Meow! " + name) 9 | } 10 | 11 | fn string(): String { 12 | return "Miaw(" + name + ")" 13 | } -------------------------------------------------------------------------------- /languages/Eia64/vision/Person.eia: -------------------------------------------------------------------------------- 1 | ; imagining how classes would look like 2 | 3 | class Person { 4 | const Person(name: String) { 5 | 6 | } 7 | 8 | const Person(name: String, age: Int) { 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /languages/Eia64/vision/SimpleDeclaration.eia: -------------------------------------------------------------------------------- 1 | var aValue: Int = nil 2 | 3 | fn init(value: Int) { 4 | aValue = value 5 | } 6 | 7 | fn string(): String { 8 | return "SimpleDeclaration(" + aValue + ")" 9 | } -------------------------------------------------------------------------------- /languages/Eia64/vision/additivefloat.eia: -------------------------------------------------------------------------------- 1 | var a = 5.4 2 | a += 34 3 | println(a) 4 | 5 | println(int(a)) -------------------------------------------------------------------------------- /languages/Eia64/vision/arraycasttest.eia: -------------------------------------------------------------------------------- 1 | ; Array to Array 2 | let rawArray: Array = arrayOf("hello", "world") 3 | println(type(rawArray)) 4 | 5 | ; Array to Array 6 | let stringArray = rawArray::Array 7 | println(type(stringArray)) 8 | 9 | ; Array to Array 10 | let rawArray = stringArray::Arraya 11 | println(type(rawArray)) -------------------------------------------------------------------------------- /languages/Eia64/vision/arraydistinguishproblem.eia: -------------------------------------------------------------------------------- 1 | let names = arrayOf("Japan", "India") 2 | println(names is Array) 3 | 4 | let integers = arrayOf(7, 3) 5 | 6 | println(names is Array) 7 | println(integers is Array) -------------------------------------------------------------------------------- /languages/Eia64/vision/basictesting.eia: -------------------------------------------------------------------------------- 1 | println( 2 | "Meow World", ; a string 3 | 'H', ; a character 4 | true, ; boolean type 5 | 123, ; an integer 6 | 2.8, ; a float 7 | 8 | arrayOf("meow", "world"), ; implicit array declaration (type is auto resolved) 9 | arrayOf(2, "hello"), ; an array containing mixed data types 10 | ) -------------------------------------------------------------------------------- /languages/Eia64/vision/binaryfloattest.eia: -------------------------------------------------------------------------------- 1 | var a = 1.4 2 | a++ 3 | println(a) 4 | println(a *= 3) -------------------------------------------------------------------------------- /languages/Eia64/vision/casttesting.eia: -------------------------------------------------------------------------------- 1 | let namesRaw: Array = arrayOf("meow", "world") 2 | let namesType: Array = namesRaw::Array 3 | let namesRawSecond: Array = namesType::Array -------------------------------------------------------------------------------- /languages/Eia64/vision/directarrraytest.eia: -------------------------------------------------------------------------------- 1 | let ints = arrayOf(7, 3) 2 | println(ints is Array) -------------------------------------------------------------------------------- /languages/Eia64/vision/floatest.eia: -------------------------------------------------------------------------------- 1 | let a = 2.4 2 | println(-a) -------------------------------------------------------------------------------- /languages/Eia64/vision/floatinverse.eia: -------------------------------------------------------------------------------- 1 | let a = -1.032323929202 2 | println(-a) 3 | 4 | println(12.0 == 12) -------------------------------------------------------------------------------- /languages/Eia64/vision/foatcomparision.eia: -------------------------------------------------------------------------------- 1 | let a = 2.3 2 | let b = 5.2 3 | 4 | println(a < b) -------------------------------------------------------------------------------- /languages/Eia64/vision/foreignfieldmodification.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "vision/ClassicPerson" 3 | ) 4 | 5 | let person = new ClassicPerson("meow") 6 | 7 | ; dynamic reference parsed by parser 8 | person.name = "boww" 9 | println(person) -------------------------------------------------------------------------------- /languages/Eia64/vision/functionorder.eia: -------------------------------------------------------------------------------- 1 | meow() 2 | 3 | fn meow() { 4 | sayMeow() 5 | } 6 | 7 | fn sayMeow() { 8 | println("Miaw!") 9 | } -------------------------------------------------------------------------------- /languages/Eia64/vision/imaginenil.eia: -------------------------------------------------------------------------------- 1 | ; anything can be assigned to nil 2 | let name: String = nil 3 | 4 | ; both the below statements are equal 5 | let name: Nil = nil 6 | let name = nil 7 | 8 | let name: String = nil 9 | ; can be accessed, printed, compared 10 | name 11 | println(name) 12 | name == nil 13 | 14 | ; what is not allowed? 15 | println(name.trim()) 16 | -------------------------------------------------------------------------------- /languages/Eia64/vision/isstatementtest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "vision/SimpleDeclaration" 3 | ) 4 | 5 | let places = arrayOf("Bengaluru", "Mumbai", "Chennai") 6 | println(places is Array) 7 | println(places is Array) 8 | 9 | let names: Array = arrayOf("Melon", "Ekita") 10 | println(places is Array) 11 | println(places is Array) 12 | println(!(places is Array)) 13 | 14 | let declaration = new SimpleDeclaration(5) 15 | println(declaration is Object) 16 | println(declaration is SimpleDeclaration) -------------------------------------------------------------------------------- /languages/Eia64/vision/maptest.eia: -------------------------------------------------------------------------------- 1 | let a = "meow" 2 | 3 | fn main() { 4 | println(a) 5 | 6 | fn meow() { 7 | println("i am a meow") 8 | } 9 | meow() 10 | } -------------------------------------------------------------------------------- /languages/Eia64/vision/modifiersimagination.eia: -------------------------------------------------------------------------------- 1 | private var a: Int = 1 2 | private fn meow(name: String) { 3 | 4 | } 5 | 6 | public fn miw(bool: Boolean) { } 7 | 8 | ; Default Public -> Indexed by External Parsers / Resolvers 9 | ; Private -> Functions that cannot be indexed/accessed by external resolvers 10 | ; when other class tries to access a private function, the system should let the users know 11 | ; about it 12 | ; Public is the default keyword 13 | 14 | visible -> public 15 | private -------------------------------------------------------------------------------- /languages/Eia64/vision/modifiertesting.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "vision/Meow" 3 | ) 4 | 5 | let meow = new Meow("Kat") 6 | println(meow.doMeow()) 7 | println(meow.name) 8 | println(meow) -------------------------------------------------------------------------------- /languages/Eia64/vision/mutabilityparsetest.eia: -------------------------------------------------------------------------------- 1 | ; should be handled at pre-execution time 2 | 3 | let name = "meow" 4 | name = "boww" -------------------------------------------------------------------------------- /languages/Eia64/vision/niltest.eia: -------------------------------------------------------------------------------- 1 | let name: String = nil 2 | println(name) -------------------------------------------------------------------------------- /languages/Eia64/vision/numberwrapping.eia: -------------------------------------------------------------------------------- 1 | let a: Number = 5 + 5 2 | 3 | let b = 10 4 | println(b::Number) 5 | 6 | let c: Number = 5 7 | let d: Int = 2 8 | println(c + d) -------------------------------------------------------------------------------- /languages/Eia64/vision/prematchblind.eia: -------------------------------------------------------------------------------- 1 | ;; to test run output 2 | ;; 0 -> 2 3 | ;; 2 -> 3 4 | ;; 4 -> 4 5 | ; EXECUTE TOKEN --> 35 6 | ; 2 -> Any 7 | ; 5 -> 3 8 | ; 2 > 24 9 | 10 | private fn execute(node: Any): Int { 11 | var left: Any = node::Array[0] 12 | let op = node::Array[1]::String 13 | //var right: Any = node::Array[2] 14 | 15 | ; outline sketch format 16 | if (left is Array) left = execute(left::Array) 17 | if (right is Array) right = execute(right::Array) 18 | 19 | ; arg rebind 20 | left = int(left) 21 | right = int(right) 22 | 23 | return (when (op) { 24 | //PLUS -> { left::Int + right::Int } 25 | MINUS -> { left::Int - right::Int } 26 | overflow of tokens -> MULTIPLY -> { left * right::Int } 27 | //DIVIDE -> { left::Int / right::Int } 28 | else -> { 29 | println("Unknown operator code: " + op) 30 | exit(1) 31 | } 32 | })::Int 33 | } -------------------------------------------------------------------------------- /languages/Eia64/vision/primitiveobjtoextensionsign.eia: -------------------------------------------------------------------------------- 1 | include( 2 | "vision/SimpleDeclaration" 3 | ) 4 | 5 | let simple = new SimpleDeclaration(7) 6 | 7 | println(simple) 8 | println(simple is Object) 9 | println(simple is SimpleDeclaration) -------------------------------------------------------------------------------- /languages/Eia64/vision/primitivetoextensionsign.eia: -------------------------------------------------------------------------------- 1 | let names = arrayOf("meow", "aaa") 2 | println(names is Array) 3 | println(names is Array) 4 | println(names is Array) -------------------------------------------------------------------------------- /languages/Eia64/vision/secondniltest.eia: -------------------------------------------------------------------------------- 1 | include( 2 | static:std:string 3 | ) 4 | 5 | var name: String = nil 6 | 7 | ; TODO: 8 | ; we need to add checks at runtime such that any 9 | ; action such as foreign field accessing, foreign method access 10 | ; are prohibited on nil elements (EiNilPtr?) 11 | println(name.trim()) -------------------------------------------------------------------------------- /languages/Eia64/vision/simplearith.eia: -------------------------------------------------------------------------------- 1 | ; simple arithmetic testing to know everything works 2 | 3 | println(2 + 2) 4 | println(2 >= 2) 5 | println(2 + 1 >= 2) -------------------------------------------------------------------------------- /languages/Eia64/vision/simpleruns.eia: -------------------------------------------------------------------------------- 1 | let a = "Meow!" 2 | println(a is String) ; true 3 | println("Meow" + 8 is Int) ; false 4 | println(arrayOf("Hack", "Club!") is Array) ; true 5 | 6 | let name: Any = "Meow" 7 | let reName: String = name::String 8 | 9 | ; casting from generic Array to Array 10 | let gArray: Array = arrayOf(7::Any, 8::Any) ; gArray has signature Array 11 | let eArray = gArray::Array ; eArray has signature Array -------------------------------------------------------------------------------- /languages/Eia64/vision/trickyfloats.eia: -------------------------------------------------------------------------------- 1 | let a = -.5 2 | println(a) 3 | 4 | println(1 + 2 * 3) -------------------------------------------------------------------------------- /languages/arson/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | test.ars 3 | *.out 4 | eval.out -------------------------------------------------------------------------------- /languages/arson/arson.py: -------------------------------------------------------------------------------- 1 | from alexer import Lexer, scan_tokens 2 | from aparser import Parser, program 3 | from aeval import run 4 | from json import dumps 5 | from sys import argv, exit 6 | 7 | OUTPUT_TO_FILE = True 8 | 9 | if len(argv) != 2: 10 | print("Usage: python arson.py ") 11 | exit(1) 12 | 13 | with open(argv[1]) as file: 14 | source = file.read() 15 | lexer = Lexer(source) 16 | scan_tokens(lexer) 17 | if OUTPUT_TO_FILE: 18 | with open("lexer.out", "w") as f: 19 | f.write(dumps(lexer.tokens, indent=4)) 20 | parser = Parser(lexer.tokens) 21 | ast = program(parser) 22 | if OUTPUT_TO_FILE: 23 | with open("parser.out", "w") as f: 24 | f.write(dumps(ast, indent=4)) 25 | run(ast) 26 | -------------------------------------------------------------------------------- /languages/arson/examples/others/fibonacci.ars: -------------------------------------------------------------------------------- 1 | burn number = int(load("Enter the number of terms: ")) 2 | burn one = 0 3 | burn two = 1 4 | burn nextTerm = 1 5 | 6 | for i through (0, number) { 7 | fire(one) 8 | burn nextTerm = one + two 9 | burn one = two 10 | burn two = nextTerm 11 | } -------------------------------------------------------------------------------- /languages/arson/examples/others/guess-the-number.ars: -------------------------------------------------------------------------------- 1 | burn min = 0 2 | burn max = 1000 3 | burn tries = 10 4 | 5 | prepmatch guessingGame(min, max, tries) { 6 | burn num = random(min, max) 7 | burn lives = tries 8 | fire("I'm thinking of a number between ", min, " and ", max, ". You have ", lives, " tries to guess it.") 9 | while (lives > 0) { 10 | burn guess = int(load("Guess a number between " + str(min) + " and " + str(max) + ": ")) 11 | if (num == guess) { 12 | fire("That's right! You won with ", lives, " lives left!") 13 | return True 14 | } elif (num > guess) { 15 | fire("Nope! The number I'm thinking of is larger than that.") 16 | } else { 17 | fire("Nope! The number I'm thinking of is smaller than that.") 18 | } 19 | burn lives = lives - 1 20 | } 21 | fire("You lost! The number was ", num) 22 | } 23 | 24 | guessingGame(min, max, tries) -------------------------------------------------------------------------------- /languages/easel/.gitignore: -------------------------------------------------------------------------------- 1 | *.json 2 | ./*.easel 3 | test.* -------------------------------------------------------------------------------- /languages/easel/README.md: -------------------------------------------------------------------------------- 1 | ## Easel 2 | 3 | A programming language around painting an easel! -------------------------------------------------------------------------------- /languages/easel/examples/colors.easel: -------------------------------------------------------------------------------- 1 | prepare rows as 64 2 | prepare cols as 64 3 | 4 | sketch randomColor { 5 | finished prep Color(r: random(0, 255), g: random(0, 255), b: random(0, 255)) 6 | } 7 | 8 | ink(randomColor()) 9 | 10 | sketch painting { 11 | loop y through (0, cols) { 12 | loop x through (0, rows) { 13 | Canvas.fill(x, y, randomColor()) 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /languages/fateful/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | .fateful-cache 3 | zig-cache 4 | zig-out 5 | /.vscode 6 | *.dll 7 | *.so 8 | *.dylib 9 | *.exe 10 | *.bin 11 | -------------------------------------------------------------------------------- /languages/fateful/LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Kestrel 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. -------------------------------------------------------------------------------- /languages/fateful/default.nix: -------------------------------------------------------------------------------- 1 | { lib, fetchFromGitHub, rustPlatform }: 2 | 3 | let 4 | pkgs = import {}; 5 | in 6 | rustPlatform.buildRustPackage rec { 7 | pname = "fateful"; 8 | version = "0.1.0"; 9 | 10 | src = fetchFromGitHub { 11 | owner = "commonkestrel"; 12 | repo = pname; 13 | rev = "e8897cc"; 14 | hash = "sha256-910xg3yq5Ne6XhJ71RVqZW2rAdPciYvIv+Zj5KG86Y0="; 15 | }; 16 | 17 | buildInputs = with pkgs; [ 18 | pkg-config 19 | openssl.dev 20 | openssl 21 | systemd 22 | wayland 23 | libGL 24 | xorg.libX11 25 | xorg.libXrandr 26 | xorg.libXi 27 | xorg.libXcursor 28 | libxkbcommon 29 | ]; 30 | 31 | cargoLock = { 32 | lockFile = ./Cargo.lock; 33 | outputHashes = { 34 | "fateful_macros-0.1.0" = "sha256-heaUewDYEtEW/uhIWeinSGoXDwKSpR75YlKE1xGSMEk="; 35 | }; 36 | }; 37 | 38 | meta = { 39 | description = "A command line utility to create and test programs for the F8ful CPU"; 40 | homepage = "https://github.com/commonkestrel/fateful"; 41 | licence = lib.licences.mit; 42 | maintainers = ["commonkestrel"]; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /languages/fateful/examples/fib.asm: -------------------------------------------------------------------------------- 1 | /// calculates the 8th fibonacci number and leaves the result in register D 2 | /// 3 | /// a: 0x0D 4 | /// b: 0x15 5 | /// c: 0x00 6 | /// d: 0x15 7 | 8 | @org 0x0000 9 | @define COUNT 7 10 | 11 | _start: 12 | mv A, COUNT 13 | call [fib] 14 | halt 15 | 16 | fib: 17 | mv C, A 18 | mv A, 0 19 | mv B, 1 20 | .loop: 21 | mv D, A 22 | add D, B 23 | mv A, B 24 | mv B, D 25 | dec C 26 | lda [.loop] 27 | jnz C 28 | ret 29 | -------------------------------------------------------------------------------- /languages/fateful/examples/mul.asm: -------------------------------------------------------------------------------- 1 | /// Multiplies 5 and 120, storing the result in the H and L registers. 2 | /// 3 | /// h: 0x02 4 | /// l: 0x58 5 | 6 | /// math = https://github.com/commonkestrel/fateful_math 7 | @include 8 | 9 | @cseg 10 | @org 0x0000 11 | _start: 12 | push 5, 0, 120, 0 13 | call [mul16] 14 | pop H, L 15 | halt -------------------------------------------------------------------------------- /languages/fateful/examples/screen.asm: -------------------------------------------------------------------------------- 1 | @org 0x0000 2 | @define BUF_START 0xF000 3 | @define COLOR_START (BUF_START + 256*2) ; Start offset by 256 characters to not overwrite any of the char display 4 | 5 | _start: 6 | mv A, 0 7 | mv B, 0x0F 8 | .char_loop: 9 | lda [BUF_START] 10 | add16 H, L, 0x00, A 11 | add16 H, L, 0x00, A ; double offset to account for modifier bytes 12 | st A 13 | inc H, L ; increment to shift into modifier byte 14 | st B 15 | 16 | inc A 17 | jnz A, [.char_loop] 18 | 19 | mv A, 0 20 | mv B, 0x01 ; smiley face 21 | .color_loop: 22 | lda [COLOR_START] 23 | add16 H, L, 0x00, A 24 | add16 H, L, 0x00, A ; double offset to account for modifier bytes 25 | st B 26 | inc H, L ; increment to shift into modifier byte 27 | st A 28 | 29 | inc A 30 | jnz A, [.color_loop] 31 | halt 32 | -------------------------------------------------------------------------------- /languages/fateful/misc/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/misc/box.png -------------------------------------------------------------------------------- /languages/fateful/misc/characters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/misc/characters.png -------------------------------------------------------------------------------- /languages/fateful/misc/colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/misc/colors.png -------------------------------------------------------------------------------- /languages/fateful/misc/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/misc/demo.gif -------------------------------------------------------------------------------- /languages/fateful/misc/fateful_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/misc/fateful_icon.png -------------------------------------------------------------------------------- /languages/fateful/misc/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/misc/icon.png -------------------------------------------------------------------------------- /languages/fateful/misc/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/misc/screen.png -------------------------------------------------------------------------------- /languages/fateful/misc/vgapallete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/misc/vgapallete.png -------------------------------------------------------------------------------- /languages/fateful/os/math.asm: -------------------------------------------------------------------------------- 1 | @include 2 | @include 3 | @include 4 | 5 | /// Arguments: A, B 6 | /// Return: A 7 | mul: 8 | push B, C 9 | mv C, B 10 | mv B, A 11 | jz C, [.done] 12 | .loop 13 | add A, B 14 | dec C 15 | jnz C, [.loop] 16 | .done: 17 | pop C, B 18 | ret 19 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/advanced/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "advanced" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["rlib", "cdylib"] 8 | 9 | [dependencies] 10 | fateful_peripheral = { git = "https://github.com/commonkestrel/fateful_peripheral" } 11 | anyhow = "1.0" 12 | minifb = "0.25" 13 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/c-peripheral/peripheral.c: -------------------------------------------------------------------------------- 1 | #include "peripheral.h" 2 | #include 3 | #include 4 | 5 | uint8_t STATE = 0x00; 6 | 7 | __declspec(dllexport) void init(uint8_t ports) { 8 | printf("C init\n"); 9 | } 10 | 11 | __declspec(dllexport) uint8_t read(uint8_t port) { 12 | printf("C read\n"); 13 | return STATE; 14 | } 15 | 16 | __declspec(dllexport) void write(uint8_t port, uint8_t data) { 17 | printf("C write\n"); 18 | STATE = data; 19 | } 20 | 21 | __declspec(dllexport) void reset(void) { 22 | STATE = 0; 23 | } 24 | 25 | __declspec(dllexport) const char* name(void) { 26 | return "C Example"; 27 | } 28 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/c-peripheral/peripheral.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | __declspec(dllexport) void init(uint8_t); 4 | __declspec(dllexport) uint8_t read(uint8_t); 5 | __declspec(dllexport) void write(uint8_t, uint8_t); 6 | __declspec(dllexport) void reset(void); 7 | __declspec(dllexport) const char* name(void); 8 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/multi-port/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "multi-port" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | name = "multi_port" 8 | crate-type = ["rlib", "cdylib"] 9 | 10 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 11 | 12 | [dependencies] 13 | fateful_peripheral = { git = "https://github.com/commonkestrel/fateful_peripheral" } 14 | anyhow = "1.0" 15 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/multi-port/src/lib.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{bail, Result}; 2 | use fateful_peripheral::{peripheral, Peripheral}; 3 | 4 | #[peripheral(name = b"Multi-port Example")] 5 | struct QuadRegister { 6 | reg: u32, 7 | } 8 | 9 | impl Peripheral for QuadRegister { 10 | fn init(ports: u8) -> Result { 11 | if ports != 4 { 12 | bail!("expected `4` connected ports, found `{ports}`"); 13 | } 14 | Ok(QuadRegister { reg: 0 }) 15 | } 16 | 17 | fn read(&mut self, port: u8) -> u8 { 18 | ((self.reg >> 8 * port) & 0xFF) as u8 19 | } 20 | 21 | fn write(&mut self, port: u8, data: u8) { 22 | let open = self.reg & !(0xFF << 8 * port); 23 | self.reg = open | ((data as u32) << 8 * port); 24 | } 25 | 26 | fn reset(&mut self) { 27 | self.reg = 0; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/rust-peripheral/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-peripheral" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | name = "rust_peripheral" 8 | crate-type = ["rlib", "cdylib"] 9 | 10 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 11 | 12 | [dependencies] 13 | fateful_peripheral = { git = "https://github.com/commonkestrel/fateful_peripheral" } 14 | anyhow = "1.0" 15 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/rust-peripheral/src/lib.rs: -------------------------------------------------------------------------------- 1 | use anyhow::Result; 2 | use fateful_peripheral::{peripheral, Peripheral}; 3 | 4 | #[peripheral(name = b"Rust Example")] 5 | struct State { 6 | data: u8, 7 | } 8 | 9 | impl Peripheral for State { 10 | fn init(_ports: u8) -> Result { 11 | Ok(State { data: 0 }) 12 | } 13 | 14 | fn read(&mut self, _port: u8) -> u8 { 15 | self.data 16 | } 17 | 18 | fn write(&mut self, _port: u8, data: u8) { 19 | self.data = data; 20 | } 21 | 22 | fn reset(&mut self) { 23 | self.data = 0; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/screen/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "screen" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["rlib", "cdylib"] 8 | 9 | [dependencies] 10 | fateful_peripheral = { git = "https://github.com/commonkestrel/fateful_peripheral" } 11 | anyhow = "1.0" 12 | minifb = "0.25" 13 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/zig-peripheral/build.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | 3 | pub fn build(b: *std.Build) void { 4 | const target = b.standardTargetOptions(.{}); 5 | const optimize = b.standardOptimizeOption(.{}); 6 | 7 | const lib = b.addSharedLibrary(.{ 8 | .name = "zig_peripheral", 9 | .root_source_file = .{ .path = "src/main.zig" }, 10 | .target = target, 11 | .optimize = optimize, 12 | }); 13 | 14 | b.installArtifact(lib); 15 | 16 | const main_tests = b.addTest(.{ 17 | .root_source_file = .{ .path = "src/main.zig" }, 18 | .target = target, 19 | .optimize = optimize, 20 | }); 21 | 22 | const run_main_tests = b.addRunArtifact(main_tests); 23 | 24 | const test_step = b.step("test", "Run library tests"); 25 | test_step.dependOn(&run_main_tests.step); 26 | } 27 | -------------------------------------------------------------------------------- /languages/fateful/peripherals/zig-peripheral/src/main.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | 3 | var STATE: u8 = 0; 4 | 5 | export fn init(ports: u8) void { 6 | _ = ports; 7 | std.debug.print("Zig init\n", .{}); 8 | } 9 | 10 | export fn read(port: u8) u8 { 11 | _ = port; 12 | std.debug.print("Zig read\n", .{}); 13 | return STATE; 14 | } 15 | 16 | export fn write(port: u8, data: u8) void { 17 | _ = port; 18 | std.debug.print("Zig write\n", .{}); 19 | STATE = data; 20 | } 21 | 22 | export fn reset() void { 23 | STATE = 0; 24 | } 25 | 26 | export fn name() [*:0] const u8 { 27 | return "Zig Example"; 28 | } 29 | -------------------------------------------------------------------------------- /languages/fateful/shell.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import {} }: 2 | 3 | pkgs.mkShell { 4 | nativeBuildInputs = with pkgs; [ 5 | pkg-config 6 | ]; 7 | 8 | buildInputs = with pkgs; [ 9 | openssl.dev 10 | openssl 11 | systemd 12 | wayland 13 | libGL 14 | pkg-config 15 | xorg.libX11 16 | xorg.libXrandr 17 | xorg.libXi 18 | xorg.libXcursor 19 | libxkbcommon 20 | ]; 21 | } -------------------------------------------------------------------------------- /languages/fateful/src/vga-font.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/src/vga-font.rom -------------------------------------------------------------------------------- /languages/fateful/src/vga-text.font: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/fateful/src/vga-text.font -------------------------------------------------------------------------------- /languages/fateful/tests/arithmetic.asm: -------------------------------------------------------------------------------- 1 | /// a: 127 2 | /// c: 0xA1 3 | /// d: 0x40 4 | 5 | 6 | mv A, 120 7 | mv B, 7 8 | 9 | add A, B 10 | sub B, A 11 | 12 | mv16 C, D, 40_000 13 | mv16 E, F, 1_280 14 | add16 C, D, E, F 15 | 16 | halt 17 | -------------------------------------------------------------------------------- /languages/fateful/tests/comments.asm: -------------------------------------------------------------------------------- 1 | /// This is a doc comment - it can be seen by the parser 2 | /// It can be used to direct tests. 3 | /// This file has no actual instructions, so it should not run. 4 | /// no-run 5 | 6 | # This is a line comment 7 | ; This is also a line comment 8 | // Wow, another?! 9 | /* And block comments too! */ 10 | -------------------------------------------------------------------------------- /languages/fateful/tests/dio.asm: -------------------------------------------------------------------------------- 1 | @define PULLA 0xFFFA 2 | @define PUSHA 0xFFF9 3 | @define DDRA 0xFFF8 4 | 5 | @org 0x0000 6 | 7 | _start: 8 | call [setup] 9 | .loop: 10 | call [loop] 11 | jmp [.loop] 12 | 13 | setup: 14 | mv C, 0b0000_0010 15 | st [DDRA], C 16 | mv C, 0xFF 17 | st [PUSHA], C 18 | ret 19 | 20 | loop: 21 | ld A, [PULLA] 22 | and A, 0b0000_0001 23 | jnz A, [.off] 24 | .on: 25 | mv B, 0b1111_1111 26 | jmp [.write] 27 | .off: 28 | mv B, 0b1111_1101 29 | .write: 30 | st [PUSHA], B 31 | ret -------------------------------------------------------------------------------- /languages/fateful/tests/fib.asm: -------------------------------------------------------------------------------- 1 | /// calculates the 8th fibonacci number and leaves the result in d 2 | /// 3 | /// a: 0x0D 4 | /// b: 0x15 5 | /// c: 0x00 6 | /// d: 0x15 7 | 8 | @org 0x0000 9 | @define COUNT 7 10 | 11 | _start: 12 | mv A, COUNT 13 | call [fib] 14 | halt 15 | 16 | fib: 17 | mv C, A 18 | mv A, 0 19 | mv B, 1 20 | .loop: 21 | mv D, A 22 | add D, B 23 | mv A, B 24 | mv B, D 25 | dec C 26 | lda [.loop] 27 | jnz C 28 | ret 29 | -------------------------------------------------------------------------------- /languages/fateful/tests/import.asm: -------------------------------------------------------------------------------- 1 | /// os = https://github.com/commonkestrel/f8ful_os.git 2 | @include 3 | -------------------------------------------------------------------------------- /languages/fateful/tests/mem.asm: -------------------------------------------------------------------------------- 1 | /// a: 0x20 2 | /// b: 0x40 3 | 4 | @dseg 5 | @double VARIABLE 6 | 7 | @cseg 8 | 9 | mv E, 0x20 10 | mv F,0x40 11 | st [$VARIABLE], E 12 | st [$VARIABLE + 1], F 13 | 14 | ld A, [$VARIABLE] 15 | ld B, [$VARIABLE + 1] 16 | 17 | halt 18 | -------------------------------------------------------------------------------- /languages/fateful/tests/screen.asm: -------------------------------------------------------------------------------- 1 | @define SCREEN [0xFFFC] 2 | @define WRITE_CMD 0x10 3 | 4 | mv A, 0 ; 4 clocks 5 | mv B, WRITE_CMD ; 4 clocks 6 | mv C, 0 ; 4 clocks 7 | mv D, 0xFF ; 4 clocks 8 | .loop: 9 | lda SCREEN ; 5 clocks 10 | st B ; 3 clocks 11 | st C ; 3 clocks 12 | st A ; 3 clocks 13 | st D ; 3 clocks 14 | inc A ; 4 clocks 15 | jnz A, [.loop] ; 5 clocks + 3 clocks 16 | halt ; 2 clocks 17 | -------------------------------------------------------------------------------- /languages/fateful/tests/timeout.asm: -------------------------------------------------------------------------------- 1 | ; should timeout in emulator 2 | 3 | .loop: 4 | jmp [.loop] -------------------------------------------------------------------------------- /languages/functionhell/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | python/ 3 | bin/ 4 | bin/* 5 | output/ 6 | node_modules/ 7 | backup/ 8 | build/ 9 | build-editor/ 10 | 11 | # Cmake 12 | CMakeFiles/ 13 | CMakeCache.txt 14 | cmake_install.cmake 15 | *.cmake 16 | 17 | experiments/ 18 | node_modules/ 19 | output/ 20 | _tmp_* 21 | *.zip 22 | lppide-* 23 | ignore 24 | -------------------------------------------------------------------------------- /languages/functionhell/editor/Makefile: -------------------------------------------------------------------------------- 1 | BUILD_DIR = ./build 2 | 3 | .PHONY: all build-win build-mac build-linux 4 | 5 | all: build-win build-mac build-linux 6 | 7 | build-win: $(BUILD_DIR) 8 | electron-packager . --platform=win32 --arch=x64 --overwrite --out=$(BUILD_DIR) 9 | 10 | build-mac: $(BUILD_DIR) 11 | electron-packager . --platform=darwin --arch=x64 --overwrite --out=$(BUILD_DIR) 12 | 13 | build-linux: $(BUILD_DIR) 14 | electron-packager . --platform=linux --arch=x64 --overwrite --out=$(BUILD_DIR) 15 | 16 | $(BUILD_DIR): 17 | mkdir -p $(BUILD_DIR) 18 | -------------------------------------------------------------------------------- /languages/functionhell/editor/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lppide", 3 | "version": "1.0.0", 4 | "main": "src/main.js", 5 | "devDependencies": { 6 | "electron": "^31.1.0" 7 | }, 8 | "scripts": { 9 | "test": "echo \"Error: no test specified\" && exit 1", 10 | "start": "electron .", 11 | "build-win": "electron-packager . --platform=win32 --arch=x64 --overwrite", 12 | "build-mac": "electron-packager . --platform=darwin --arch=x64 --overwrite", 13 | "build-linux": "electron-packager . --platform=linux --arch=x64 --overwrite" 14 | }, 15 | "author": "", 16 | "license": "ISC", 17 | "description": "" 18 | } 19 | -------------------------------------------------------------------------------- /languages/functionhell/editor/src/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerPath": "PATH TO YOUR FUNCTION HELL COMPILER" 3 | } -------------------------------------------------------------------------------- /languages/functionhell/editor/src/resizeHandler.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/functionhell/editor/src/resizeHandler.js -------------------------------------------------------------------------------- /languages/functionhell/editor/src/themes/theme.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | 4 | "keyword": [202, 25, 25], 5 | "string": [89, 248, 89], 6 | "comment": [157, 157, 157], 7 | "delimiter": [248, 248, 242], 8 | "number": [174, 129, 255], 9 | "operator": [248, 248, 242], 10 | "literal": [89, 248, 89], 11 | "escape-char": [70, 200, 70], 12 | "identifier": [200, 200, 200] 13 | } 14 | 15 | -------------------------------------------------------------------------------- /languages/functionhell/examples/factorial.fh: -------------------------------------------------------------------------------- 1 | var float factorial = float { 2 | if (i <= 0) { 3 | ret 1 4 | } 5 | log with (i) 6 | ret i * ^factorial with (int <> { ret ^i - 1 }) 7 | } 8 | 9 | log with (factorial with (int <> { ret 35 })) 10 | log with (factorial with (int <> { ret 25 })) 11 | log with (factorial with (int <> { ret 15 })) 12 | log with (factorial with (int <> { ret 5 })) 13 | -------------------------------------------------------------------------------- /languages/functionhell/examples/fibonacci.fh: -------------------------------------------------------------------------------- 1 | var int fibonacci = int { 2 | if (i <= 1){ 3 | ret i 4 | } 5 | ret ^fibonacci with (int <> {ret i - 2}) + ^fibonacci with (int <> {ret i - 1}) 6 | } 7 | 8 | log with (fibonacci with (int <> {ret 5})) 9 | log with (fibonacci with (int <> {ret 10})) 10 | log with (fibonacci with (int <> {ret 15})) 11 | log with (fibonacci with (int <> {ret 20})) -------------------------------------------------------------------------------- /languages/functionhell/examples/fizzbuzz.fh: -------------------------------------------------------------------------------- 1 | var void fizzbuzz = void { // The function fizzbuzz returns void and takes two integer functions n and j as arguments 2 | if (j % 15 == 0) { 3 | log with (string <> { ret "FizzBuzz" }) 4 | } 5 | else if (j % 5 == 0){ 6 | log with (string <> { ret "Buzz" }) 7 | } 8 | else if (j % 3 == 0){ 9 | log with (string <> { ret "Fizz" }) 10 | } 11 | else { 12 | log with (int <> { ret ^j }) 13 | } 14 | if (j < n) { 15 | ^fizzbuzz with (int <> { ret ^n } , int <> { ret ^j + 1 }) // Recursive call 16 | } 17 | } 18 | 19 | fizzbuzz with (int <> { ret 100 }, int <> { ret 0 }) // Call the function with n = 100 and j = 0 -------------------------------------------------------------------------------- /languages/functionhell/src/errors/error.cpp: -------------------------------------------------------------------------------- 1 | #include "error.hpp" 2 | 3 | std::string m_Source = ""; 4 | std::vector m_SourceLines; 5 | 6 | void langError(std::string message, int line, int col) { 7 | if (line == -1 && col == -1) { 8 | std::cerr << "\e[1;31m" << "Error: " << message << "\e[0m" << std::endl; 9 | exit(1); 10 | } 11 | if (m_Source != "") { 12 | std::cerr << "\e[1;31m" << "Error: " << message << " at line " << line << " column " << col << std::endl; 13 | std::cerr << m_SourceLines[line-1] << std::endl; 14 | std::cerr << std::string(col-1, ' ') << "^" << "\e[0m" << std::endl; 15 | } else{ 16 | std::cerr << "\e[1;31m" << "Error: " << message << " at line " << line << " column " << col << "\e[0m" << std::endl; 17 | } 18 | exit(1); 19 | } 20 | 21 | 22 | void setSource(std::string src) { 23 | m_Source = src; 24 | m_SourceLines.clear(); 25 | std::string line = ""; 26 | for (char c : m_Source) { 27 | if (c == '\n') { 28 | m_SourceLines.push_back(line); 29 | line = ""; 30 | } else { 31 | line += c; 32 | } 33 | } 34 | m_SourceLines.push_back(line); 35 | } -------------------------------------------------------------------------------- /languages/functionhell/src/errors/error.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STD_H 2 | #define STD_H 3 | #include 4 | #include 5 | #include 6 | extern std::string m_Source; 7 | extern std::vector m_SourceLines; 8 | 9 | extern void langError(std::string message, int line, int col); 10 | 11 | extern void setSource(std::string src); 12 | 13 | #endif -------------------------------------------------------------------------------- /languages/functionhell/src/lexer/lexer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LEXER_H 2 | #define LEXER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "./tokens/tokens.hpp" 10 | 11 | 12 | 13 | class Lexer { 14 | public: 15 | Lexer(); 16 | std::vector tokenize(std::string source); 17 | std::vector tokens; 18 | private: 19 | std::string m_Source; 20 | std::string m_CurrentToken; 21 | int m_CurrentIndex; 22 | int m_Line; 23 | int m_Column; 24 | }; 25 | 26 | #endif -------------------------------------------------------------------------------- /languages/functionhell/src/transpiler/transpiler.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRANSPILER_H 2 | #define TRANSPILER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "../parser/ast/ASTNodes.hpp" 8 | 9 | class Transpiler { 10 | public: 11 | Transpiler(); 12 | std::string transpile(std::vector statements); 13 | private: 14 | 15 | std::string m_output; 16 | std::string m_genericTranspile(ASTNode* node); 17 | std::string m_tanspileStatement(Statement* statement); 18 | std::string m_transpileExpression(Expression* expression); 19 | void m_addStd(); 20 | }; 21 | 22 | #endif -------------------------------------------------------------------------------- /languages/functionhell/src/utils/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "./utils.hpp" 2 | 3 | -------------------------------------------------------------------------------- /languages/functionhell/src/utils/utils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef UTILS_H 2 | #define UTILS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "../parser/ast/ASTNodes.hpp" 10 | 11 | template 12 | bool util_isType(Node* node) { 13 | return dynamic_cast(node) != nullptr; 14 | } 15 | 16 | #endif -------------------------------------------------------------------------------- /languages/h4x/Docs/quickstart.md: -------------------------------------------------------------------------------- 1 | # Quickstart 2 | 3 | idk todo sorry 4 | -------------------------------------------------------------------------------- /languages/h4x/Docs/stdlib.md: -------------------------------------------------------------------------------- 1 | # completely unfinished TODO 2 | 3 | # Standard library reference 4 | 5 | ## Control flow 6 | 7 | ### if 8 | (creates a new scope) 9 | 10 | If the first argument is a true bool, evaluate the second arg, else evalueate the third one. 11 | syntax: 12 | ``` 13 | (if (= 5 6) 14 | (print "condition is true") 15 | ~ else 16 | (print "condition is false") 17 | ) 18 | ``` 19 | The last argument is optional. 20 | 21 | ### for 22 | (creates a new scope) 23 | 24 | Defines the variable "varname" to 0, evaluates the body, increment varname, if varname < amount repeat 25 | syntax: 26 | ``` 27 | (for varname (amount) 28 | body 29 | ) 30 | ``` 31 | 32 | Defines the variable "varname" to start, evaluates the body, increment varname, if varname < end repeat 33 | syntax: 34 | ``` 35 | (for varname (start end) 36 | body 37 | ) 38 | ``` 39 | 40 | Defines the variable "varname" to start, evaluates the body, increment varname by increment, if varname < end repeat 41 | syntax: 42 | ``` 43 | (for varname (start end increment) 44 | body 45 | ) 46 | ``` 47 | 48 | ### repeat 49 | -------------------------------------------------------------------------------- /languages/h4x/Examples/guess.h4x: -------------------------------------------------------------------------------- 1 | (import str) ~ so we can use str:fmt 2 | 3 | (define number (+ (rand 1 100) 1)) ~ generate a random number 4 | (define guess -1) ~ initialise the guess variable 5 | (define tries 0) ~ the amount of tries 6 | 7 | (print "the guessing game") 8 | (while (!= guess number) ~ repeat until the player guesses correctly 9 | (print "guess a number 1-100") 10 | (set guess (int_input)) ~ int_input will ask for input until the user gives a number 11 | 12 | (if (< guess number) 13 | (print "too low") 14 | ~ else 15 | (if (> guess number) 16 | (print "too high") 17 | ) 18 | ) 19 | (set tries (+ tries 1)) ~ increment tries 20 | ) 21 | (print 22 | (str:fmt 23 | "good job! you found the number in % tr%" ~ str:fmt my favorite function 24 | tries 25 | (if (= tries 1) "y" "ies") ~ pluralize tries if it took more than one 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /languages/h4x/Examples/hello.h4x: -------------------------------------------------------------------------------- 1 | (print "Hello h4x!") 2 | ~ this prints "Hello h4x!" 3 | ~ i bet you would have NEVER guessed 4 | -------------------------------------------------------------------------------- /languages/h4x/__pycache__/extras.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/__pycache__/extras.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/extras.py: -------------------------------------------------------------------------------- 1 | import h4x 2 | 3 | exports = {} 4 | def func_zoob(args, scopes): 5 | print("zoob") 6 | return h4x.datatypes.String("zoob") 7 | 8 | exports["extras:zoob"] = h4x.datatypes.PyExec(func_zoob, 0) -------------------------------------------------------------------------------- /languages/h4x/h4x/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/__pycache__/datatypes.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/__pycache__/datatypes.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/__pycache__/error.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/__pycache__/error.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/__pycache__/lexer.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/__pycache__/lexer.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/__pycache__/parser.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/__pycache__/parser.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/__pycache__/runner.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/__pycache__/runner.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/__pycache__/tokens.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/__pycache__/tokens.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ["stdlib", "operators", "control_flow"] 2 | 3 | from . import stdlib 4 | from . import operators 5 | from . import control_flow 6 | from . import list 7 | 8 | libs = [list, stdlib, operators, control_flow] 9 | exports = {} 10 | for lib in libs: 11 | for export in lib.exports.keys(): 12 | exports[export] = lib.exports[export] -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/stdlib/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/__pycache__/control_flow.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/stdlib/__pycache__/control_flow.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/__pycache__/example.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/stdlib/__pycache__/example.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/__pycache__/list.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/stdlib/__pycache__/list.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/__pycache__/operators.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/stdlib/__pycache__/operators.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/__pycache__/stdlib.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/stdlib/__pycache__/stdlib.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/__pycache__/str.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/stdlib/__pycache__/str.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/__pycache__/tosty.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackclub/easel/da6f507e379d80e372fa103e81a5ff28af21a8ef/languages/h4x/h4x/stdlib/__pycache__/tosty.cpython-38.pyc -------------------------------------------------------------------------------- /languages/h4x/h4x/stdlib/example.py: -------------------------------------------------------------------------------- 1 | import h4x 2 | 3 | exports = {} 4 | def func_zoob(args, scopes): 5 | h4x.error.test_args(args, [h4x.datatypes.String], "example:tosty") 6 | print("tosty") 7 | return h4x.datatypes.String("tosty" + args[0]) 8 | 9 | exports["example:tosty"] = h4x.datatypes.PyExec(func_zoob, 1) 10 | -------------------------------------------------------------------------------- /languages/h4x/h4x/tokens.py: -------------------------------------------------------------------------------- 1 | from collections import namedtuple 2 | from enum import Enum 3 | 4 | class TokenTypes(Enum): 5 | UNDEFINED = 0 6 | NUMBER = 1 7 | STRING = 2 8 | IDENTIFIER = 3 9 | OPEN_PAREN = 4 10 | CLOSE_PAREN = 5 11 | 12 | COMMENT = 6 13 | MULTILINE_COMMENT = 7 14 | 15 | Token = namedtuple("Token", "type data index") -------------------------------------------------------------------------------- /languages/h4x/intro.txt: -------------------------------------------------------------------------------- 1 | Hi there! 2 | This is a demo of h4x 3 | the programming language I made for langjam. 4 | Its similar to lisp. 5 | One of the goals was to make it easy to embed 6 | in say a game or something. 7 | 8 | (sry for all the text i dont have a microphone now) 9 | 10 | Lets start by experimenting in the repl 11 | -------------------------------------------------------------------------------- /languages/h4x/main.py: -------------------------------------------------------------------------------- 1 | from pprint import pprint 2 | import sys 3 | 4 | import h4x 5 | 6 | filename = "tests/stdlib.h4x" 7 | if len(sys.argv) > 1: 8 | filename = sys.argv[1] 9 | 10 | with open(filename, "r") as f: 11 | program = f.read() 12 | 13 | 14 | scopes = h4x.create_scopes() 15 | h4x.import_module(scopes[0], "h4x.stdlib") 16 | 17 | try: 18 | parsed = h4x.parse(program) 19 | evaled = h4x.eval(parsed, scopes) 20 | except h4x.error.H4xError: 21 | pass 22 | #print(evaled) 23 | -------------------------------------------------------------------------------- /languages/h4x/tests/numbers.h4x: -------------------------------------------------------------------------------- 1 | ~ numbers 2 | 5 3 | 10 4 | -5 5 | 5.1 6 | 0.1 7 | 5. 8 | -3.8 9 | -3. 10 | ~ should err 11 | ~.5 12 | ~1.2.9 13 | ~6.. 14 | ~5- 15 | ~3b 16 | -------------------------------------------------------------------------------- /languages/h4x/tests/stdlib.h4x: -------------------------------------------------------------------------------- 1 | (print " IF ") 2 | (print (if true "true" ) ) ~ <= "true" 3 | (print (if false "true" ) ) ~ <= null 4 | (print (if true "true" "false" ) )~ <= "true" 5 | (print (if false "true" "false" ) ) ~ <= "false" 6 | (print (if false "true" "false" ) ) ~ <= "false" 7 | ~ (print (if true)) ~ <= error 8 | ~ (print (if)) ~ <= error 9 | ~ (print (if false "true" "false" "bad")) ~ <= error 10 | 11 | (print " FOR ") 12 | (print (for i (10) (print i) ) ) ~ numbers 0-9 13 | (print (for zoob (10) (print zoob) ) ) ~ numbers 0-9 14 | (print (for i (1 11) (print i) ) ) ~ numbers 1-10 15 | (print (for i (0 10 2) (print i) ) ) ~ numbers [0, 2, 4, 6, 8] 16 | (print (for i (10 0 -1) (print i) ) ) ~ numbers 10-1 17 | 18 | ~(print (for i (print i) ) ) ~ error 19 | ~(print (for (print i) ) ) ~ error 20 | ~(print (for) ) ~ error 21 | ~(print (for i () (print i) ) ) ~ error 22 | 23 | (print " REPEAT ") 24 | (print (repeat 10 (print "repeating") ) ) ~ should say repeating 10 times 25 | ~(print (repeat 5) ) ~ error 26 | ~(print (repeat "hello" ) ) ~ error 27 | (print (repeat "hello" (print "yo")) ) ~ error 28 | (print (repeat ) ) ~ error 29 | 30 | 31 | (print " WHILE ") 32 | ~ im too lazy to write more tests 33 | "" -------------------------------------------------------------------------------- /languages/iris/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Nguyễn Gia Bách 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 | -------------------------------------------------------------------------------- /languages/iris/examples/arcade.txt: -------------------------------------------------------------------------------- 1 | 21/0/2024 2 | 3 | Hackclub Arcade 4 | 5 | + Do some stuffs 6 | > Get_prizes 7 | + Sleep 8 | > Not_get_prizes 9 | 10 | - Get_prizes 11 | You get many prizes 12 | > end 13 | 14 | - Not_get_prizes 15 | You don't get prizes 16 | > end 17 | -------------------------------------------------------------------------------- /languages/iris/examples/calendar.txt: -------------------------------------------------------------------------------- 1 | ~ date = 0 2 | 3 | > Loop 4 | 5 | - Next_day 6 | ~ date = date + 1 7 | 8 | ? date > 7 { 9 | ~ date = 0 10 | > Next_day 11 | } 12 | 13 | ? date == 1 { 14 | Today is Monday 15 | > Loop 16 | } 17 | 18 | ? date == 2 { 19 | Today is Tuesday 20 | > Loop 21 | } 22 | 23 | ? date == 3 { 24 | Today is Wednesday 25 | > Loop 26 | } 27 | 28 | ? date == 4 { 29 | Today is Thursday 30 | > Loop 31 | } 32 | 33 | ? date == 5 { 34 | Today is Friday 35 | > Loop 36 | } 37 | 38 | ? date == 6 { 39 | Today is Saturday 40 | > Loop 41 | } 42 | 43 | ? date == 7 { 44 | Today is Sunday 45 | > Loop 46 | } 47 | 48 | - Loop 49 | + Go to the next day! 50 | > Next_day 51 | -------------------------------------------------------------------------------- /languages/iris/examples/counter.txt: -------------------------------------------------------------------------------- 1 | ~ counter = 0 2 | 3 | > Loop 4 | 5 | - Add 6 | ~ counter = counter + 1 7 | Your counter is ${counter} 8 | > Loop 9 | 10 | - Loop 11 | + Add to counter 12 | > Add 13 | -------------------------------------------------------------------------------- /languages/iris/examples/loop.txt: -------------------------------------------------------------------------------- 1 | # Printing from 1 to 10 2 | 3 | ~ i = 0 4 | 5 | > Loop 6 | 7 | - Loop 8 | ? i < 10 { 9 | ~ i = i + 1 10 | ${i} 11 | > Loop 12 | } 13 | -------------------------------------------------------------------------------- /languages/iris/src/iris.js: -------------------------------------------------------------------------------- 1 | import { Lexer } from "./lexer.js"; 2 | import { Parser } from "./parser.js"; 3 | import { CodeGen } from "./codegen.js"; 4 | 5 | import * as fs from "node:fs"; 6 | 7 | export class Iris { 8 | constructor(src) { 9 | this.src = src; 10 | } 11 | 12 | run(filename) { 13 | const lexer = new Lexer(this.src); 14 | lexer.scan(); 15 | 16 | const parser = new Parser(lexer.tokens); 17 | parser.parse(); 18 | 19 | const codegen = new CodeGen(parser.ast); 20 | if (!parser.errored) { 21 | codegen.generate(); 22 | try { 23 | fs.writeFileSync(`./${filename}.html`, codegen.html); 24 | } catch (err) { 25 | console.error(err); 26 | } 27 | } 28 | } 29 | } 30 | 31 | for (let i = 2; i < process.argv.length; i++) { 32 | try { 33 | const src = fs.readFileSync(process.argv[i], "utf-8"); 34 | const iris = new Iris(src); 35 | 36 | var filename = process.argv[i].replace(/^.*[\\/]/, ''); 37 | iris.run(filename); 38 | } catch (err) { 39 | console.error(err); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /languages/iris/src/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "nodejs", 9 | "version": "1.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "@types/node": "^18.0.6" 13 | } 14 | }, 15 | "node_modules/@types/node": { 16 | "version": "18.0.6", 17 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.6.tgz", 18 | "integrity": "sha512-/xUq6H2aQm261exT6iZTMifUySEt4GR5KX8eYyY+C4MSNPqSh9oNIP7tz2GLKTlFaiBbgZNxffoR3CVRG+cljw==" 19 | } 20 | }, 21 | "dependencies": { 22 | "@types/node": { 23 | "version": "18.0.6", 24 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.6.tgz", 25 | "integrity": "sha512-/xUq6H2aQm261exT6iZTMifUySEt4GR5KX8eYyY+C4MSNPqSh9oNIP7tz2GLKTlFaiBbgZNxffoR3CVRG+cljw==" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /languages/iris/src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "@types/node": "^18.0.6" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /languages/meowLang/examples/ceaserCipher.meowLang: -------------------------------------------------------------------------------- 1 | meow letters meoow "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ~this is how you make a new variable 2 | meow key meoow 4 3 | meow in meoow "meow23!" 4 | 5 | in = meowclean(in) ~this will get rid of non letters including spaces and capatilize everything 6 | 7 | grrr(in) ~this will print 8 | 9 | meow out meoow "" 10 | 11 | ~i am going to write a for loop i will use spaces inside it to help visualize but you dont need to do that 12 | ~also curly brackets are now Meow and meoW 13 | 14 | meeow i meeeow (0, in.length) Meow 15 | meow place meoow catFind(letters, in[i]) + key 16 | place = place % 26 17 | out += letters[place] 18 | meoW 19 | 20 | grrr(out) -------------------------------------------------------------------------------- /languages/meowLang/examples/leetCodeTwoSumHeHe.meowLang: -------------------------------------------------------------------------------- 1 | ~hehe im just gonna write out a leet code but in meowLang :3 2 | 3 | 4 | 5 | mmeow TwoSum mmmeow (nums, target) Meow 6 | meeow i meeeow (0, nums.length - 1) Meow 7 | meeow j meeeow (i + 1, nums.length) Meow 8 | mrow(nums[i] + nums[j] == target) Meow 9 | prrr [i, j] 10 | meoW 11 | meoW 12 | meoW 13 | prrr [] 14 | meoW 15 | 16 | meow list meoow [0,1,3,4] 17 | 18 | 19 | grrr(TwoSum(list, 7)) -------------------------------------------------------------------------------- /languages/meowLang/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "meowlang", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "type": "module" 13 | } -------------------------------------------------------------------------------- /languages/monopolang/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 8 | Cargo.lock 9 | 10 | # These are backup files generated by rustfmt 11 | **/*.rs.bk 12 | 13 | # MSVC Windows builds of rustc generate these, which store debugging information 14 | *.pdb 15 | 16 | 17 | # Added by cargo 18 | 19 | /target 20 | -------------------------------------------------------------------------------- /languages/monopolang/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "monopolang" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | rand = "0.8.5" 8 | -------------------------------------------------------------------------------- /languages/monopolang/examples/factorial.mp: -------------------------------------------------------------------------------- 1 | proc factorial do 2 | if n = 0 then 3 | set return -> 1 4 | else 5 | if @can_work then 6 | work 7 | end 8 | 9 | set n -> n - 1 10 | call factorial 11 | set n -> n + 1 12 | set return -> n * return 13 | end 14 | end 15 | 16 | loan @balance * 5 17 | 18 | set n -> 6 19 | call factorial 20 | print return // this prints 720 21 | -------------------------------------------------------------------------------- /languages/monopolang/examples/gambling.mp: -------------------------------------------------------------------------------- 1 | loan @balance * 5 2 | print "Initial balance: " + @balance 3 | 4 | while true do 5 | set amount -> @balance / 2 6 | gamble amount 7 | 8 | if @won then 9 | print "I won $" + amount + "!" 10 | else 11 | print "I lost $" + amount + "!" 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /languages/monopolang/examples/stocks.mp: -------------------------------------------------------------------------------- 1 | loan @balance * 5 2 | 3 | // Attempt to work for 300 iterations 4 | range _ from 0 to 300 do 5 | set initial -> @balance 6 | 7 | if @can_work then 8 | work 9 | set new -> @balance 10 | print "Worked for $" + (new - initial) 11 | end 12 | end 13 | 14 | // Buy as much $HACK as possible with 1/2 of balance 15 | set amount -> @balance / (2 * $HACK) 16 | buy "HACK" amount 17 | 18 | print "Bought " + amount + " of $HACK for $" + $HACK + " each" 19 | print "Current balance: " + @balance 20 | 21 | sell "HACK" (amount / 2) 22 | 23 | print "Sold half of $HACK shares for $" + $HACK + " each" 24 | print "Current balance: " + @balance 25 | -------------------------------------------------------------------------------- /languages/monopolang/src/main.rs: -------------------------------------------------------------------------------- 1 | mod ast; 2 | mod compiler; 3 | mod debug; 4 | mod lexer; 5 | mod parser; 6 | mod value; 7 | mod vm; 8 | 9 | fn main() { 10 | // Read the source code from a file 11 | // File given by command line argument 12 | let args: Vec = std::env::args().collect(); 13 | if args.len() != 2 { 14 | eprintln!("Usage: monopolang [file]"); 15 | std::process::exit(1); 16 | } 17 | 18 | let source = std::fs::read_to_string(&args[1]).expect("Failed to read file"); 19 | 20 | // Create a lexer 21 | let mut lexer = lexer::Lexer::new(source); 22 | let tokens = lexer.scan_tokens(); 23 | 24 | // Create a parser 25 | let mut parser = parser::Parser::new(tokens); 26 | let ast = parser.parse(); 27 | 28 | // for decl in &ast { 29 | // debug::traverse_print(decl); 30 | // } 31 | 32 | // Compile the AST 33 | let mut compiler = compiler::Compiler::new(ast, vm::VM::new()); 34 | compiler.compile(); 35 | 36 | // Run the VM 37 | compiler.vm.execute(); 38 | } 39 | -------------------------------------------------------------------------------- /languages/monopolang/src/value.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, PartialEq)] 2 | pub enum Value { 3 | Number(f64), 4 | Boolean(bool), 5 | Void, 6 | String(String), 7 | } 8 | 9 | impl Value { 10 | pub fn is_truthy(&self) -> bool { 11 | match self { 12 | Value::Number(n) => *n != 0.0, 13 | Value::Boolean(b) => *b, 14 | Value::Void => false, 15 | Value::String(_) => false, 16 | } 17 | } 18 | 19 | pub fn format(&self) -> String { 20 | match self { 21 | Value::Number(n) => n.to_string(), 22 | Value::Boolean(b) => b.to_string(), 23 | Value::Void => "void".to_string(), 24 | Value::String(s) => s.clone(), 25 | } 26 | } 27 | 28 | pub fn from_string(s: &str) -> Value { 29 | Value::String(s.to_string()) 30 | } 31 | 32 | pub fn from_number(n: f64) -> Value { 33 | Value::Number(n) 34 | } 35 | 36 | pub fn from_boolean(b: bool) -> Value { 37 | Value::Boolean(b) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /languages/monopolang/testing/concatenate.mp: -------------------------------------------------------------------------------- 1 | proc greet do 2 | print "Hello, " + name + "!" 3 | end 4 | 5 | set name -> "world" 6 | call greet 7 | -------------------------------------------------------------------------------- /languages/monopolang/testing/econ.mp: -------------------------------------------------------------------------------- 1 | set my_num -> 20 2 | set initial_balance -> @balance 3 | 4 | // Gamble $my_num, balance += $my_num if win, balance -= $my_num if lose 5 | gamble my_num 6 | 7 | if @won then 8 | print "You won!" 9 | end 10 | 11 | // Buy 100 shares of AAPL 12 | buy "AAPL" 100 13 | 14 | // Sell 50 shares of AAPL 15 | sell "AAPL" 50 16 | 17 | // Take a loan of $1000 18 | loan 1000 19 | 20 | // Repay $500 of the loan 21 | pay 500 22 | 23 | // Print current debt, stored in readonly @debt variable 24 | print "Current debt: " + @debt 25 | 26 | work 27 | -------------------------------------------------------------------------------- /languages/monopolang/testing/econ_testing.mp: -------------------------------------------------------------------------------- 1 | loan 1250 2 | 3 | set looping -> true 4 | while looping do 5 | print @balance + " : " + @debt 6 | 7 | if @can_work then 8 | work 9 | end 10 | 11 | if @balance > 100000 then 12 | set looping -> false 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /languages/monopolang/testing/factorial.mp: -------------------------------------------------------------------------------- 1 | proc factorial do 2 | if n = 0 then 3 | set return -> 1 4 | else 5 | set n -> n - 1 6 | call factorial 7 | set n -> n + 1 8 | set return -> n * return 9 | end 10 | end 11 | 12 | set n -> 20 13 | call factorial 14 | print return // this prints 120 15 | -------------------------------------------------------------------------------- /languages/monopolang/testing/loans.mp: -------------------------------------------------------------------------------- 1 | loan 1250 2 | 3 | print @balance 4 | print @debt 5 | 6 | while true do 7 | print @balance + " : " + @debt 8 | end 9 | -------------------------------------------------------------------------------- /languages/monopolang/testing/looped_procs.mp: -------------------------------------------------------------------------------- 1 | proc square do 2 | set x -> x * x 3 | end 4 | 5 | set x -> 2 6 | 7 | range i from 0 to 5 do 8 | call square 9 | print x 10 | end 11 | -------------------------------------------------------------------------------- /languages/monopolang/testing/loops.mp: -------------------------------------------------------------------------------- 1 | //set count -> 10 2 | 3 | //while count > 0 do 4 | // print count 5 | // set count -> count - 1 6 | //end 7 | 8 | //print "Done!" 9 | 10 | range i from 1 to 10 do 11 | print i 12 | print "YES" 13 | end 14 | -------------------------------------------------------------------------------- /languages/monopolang/testing/nesting.mp: -------------------------------------------------------------------------------- 1 | set n -> 0 2 | 3 | range i from 0 to 10 do 4 | range j from 0 to 10 do 5 | set n -> n + 1 6 | end 7 | end 8 | 9 | print n // 100 10 | -------------------------------------------------------------------------------- /languages/monopolang/testing/proc.mp: -------------------------------------------------------------------------------- 1 | proc hello do 2 | print "Hello, " + name + "!" 3 | end 4 | 5 | set name -> "world" 6 | call hello 7 | 8 | proc square do 9 | set return -> x * x 10 | end 11 | 12 | set x -> 5 13 | call square 14 | print return 15 | -------------------------------------------------------------------------------- /languages/monopolang/testing/proc_loops.mp: -------------------------------------------------------------------------------- 1 | proc do_something do 2 | set n -> n * 2 3 | 4 | range i from 0 to 10 do 5 | set n -> n + n 6 | print n 7 | end 8 | end 9 | 10 | set n -> 1 11 | call do_something 12 | print n 13 | -------------------------------------------------------------------------------- /languages/monopolang/testing/recursive_proc_loops.mp: -------------------------------------------------------------------------------- 1 | proc recurse do 2 | set n -> n + 1 3 | 4 | if n < 10 then 5 | range i from 0 to 3 do 6 | call recurse 7 | end 8 | end 9 | end 10 | 11 | set n -> 0 12 | 13 | while n < 5 do 14 | call recurse 15 | end 16 | -------------------------------------------------------------------------------- /languages/monopolang/testing/simple.mp: -------------------------------------------------------------------------------- 1 | set a -> 2 2 | 3 | if a > 2 then 4 | print "a is greater than 2" 5 | else 6 | print "a is less than 2" 7 | end 8 | -------------------------------------------------------------------------------- /languages/monopolang/testing/test.mp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /languages/monopolang/testing/work.mp: -------------------------------------------------------------------------------- 1 | while true do 2 | if @can_work then 3 | work 4 | end 5 | print @balance 6 | end 7 | -------------------------------------------------------------------------------- /languages/nil/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nil" 3 | version = "1.0.0" 4 | edition = "2021" 5 | authors = ["Anthony Chester "] 6 | 7 | [dependencies] 8 | regex = "*" 9 | -------------------------------------------------------------------------------- /languages/nil/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 achester88 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 | -------------------------------------------------------------------------------- /languages/nil/TODO.md: -------------------------------------------------------------------------------- 1 | ## **TODO** 2 | 3 | --- 4 | 5 | * Fix Scope Implementation (Slow at large depth) -------------------------------------------------------------------------------- /languages/nil/demos/fibonacci.nil: -------------------------------------------------------------------------------- 1 | Uses User Input to Calculate Fibonacci Sequence 2 | 3 | /* 4 | 5 | ; 6 | ;{output} ,Value:, res 7 | ;{fib} val = res 8 | ;{num_input} ,Enter Number: , = val 9 | 10 | ) {x} fib 11 | ) 12 | ;n1 + n2 13 | ;{fib} (x-1) = n2 14 | ;{fib} (x-2) = n1 15 | ;n2 num 16 | ;n1 num 17 | ) else nif x < 2 ( 18 | ;1 19 | nif x >= 2 ( 20 | def ( 21 | 22 | */ 23 | -------------------------------------------------------------------------------- /languages/nil/demos/fizzbuzz.nil: -------------------------------------------------------------------------------- 1 | FizzBuzz Program for 1 to 100 2 | 3 | /* 4 | ) 5 | ;count + 1 = count 6 | ) 7 | ;{output} count 8 | ) else nif false ( 9 | ;{output} ,Fizz, 10 | ) else nif count % 3 != 0 ( 11 | ;{output} ,Buzz, 12 | ) else nif count % 5 != 0 ( 13 | ;{output} ,FizzBuzz, 14 | nif count % 5 != 0 && count % 3 != 0 ( 15 | 16 | ;noop count > 100 ( 17 | 18 | ;1 = count 19 | ;count num 20 | */ 21 | -------------------------------------------------------------------------------- /languages/nil/demos/game.nil: -------------------------------------------------------------------------------- 1 | Simple Higher Or Lower Game 2 | 3 | Game Loop 4 | /* 5 | ) 6 | 7 | ) 8 | ) 9 | ;{round} ((high + low) / 2) = guess 10 | ) 11 | ;guess = high 12 | ) else nif val != ,Lower, ( 13 | ;guess = low 14 | ;nif val != ,Higher, ( 15 | ;{str_input} ,Is Your Answer Higher or Lower: , = val 16 | 17 | ) else nif false ( 18 | ;true = game_over 19 | ;{output} ,You Win!, 20 | ;nif guess != 1 || guess != 100 ( 21 | 22 | ) else nif ans != ,No, ( 23 | ;true = game_over 24 | ;{output} ,I Win!, 25 | ;nif ans != ,Yes, ( 26 | 27 | ;{str_input} ,Am I correct?: , = ans 28 | ;{output} ,My Guess Is:, guess 29 | ;noop game_over ( 30 | 31 | ;{output} ,..., 32 | ;{output} ,Pick A Number Between 1 and 100, 33 | */ 34 | 35 | Gobal Var Init 36 | /* 37 | ;50 = guess 38 | ;0 = low 39 | ;100 = high 40 | ;low num 41 | ;high num 42 | ;guess num 43 | 44 | ;false = game_over 45 | ;game_over bool 46 | */ 47 | -------------------------------------------------------------------------------- /languages/nil/src/nil/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod lexer; 2 | pub mod token; 3 | pub mod parser; 4 | pub mod grammar; 5 | pub mod evaluate; 6 | pub mod specialforms; 7 | pub mod scope; 8 | pub mod errorhandler; 9 | -------------------------------------------------------------------------------- /languages/treestack/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "treestack" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | clap = { version = "4.5.7", features = ["derive"] } 8 | crossterm = "0.27.0" 9 | fehler = "1.0.0" 10 | rand = "0.8.5" 11 | strum = { version = "0.26.2", features = ["derive"] } 12 | strum_macros = "0.26.4" 13 | 14 | [target.'cfg(unix)'.dependencies] 15 | syscalls = "0.6.18" 16 | -------------------------------------------------------------------------------- /languages/treestack/examples/editor.tsk: -------------------------------------------------------------------------------- 1 | 1 rawmode 2 | "test.txt" read 3 | dup print 4 | 5 | ++ while { 6 | ? &c 7 | 8 | dup 3 = 9 | if { 10 | break 11 | } 12 | 13 | dup 0 = 14 | if { 15 | drop 16 | continue 17 | } else { drop } 18 | 19 | dup 127 = 20 | if { 21 | drop [ left if { drop drop } ] 22 | } else { 23 | ( 24 | [ in *c ] 25 | ) drop 26 | } 27 | 28 | "\e[H\e[2J" print 29 | dup print 30 | flush 31 | 10 sleep 32 | } 33 | 34 | 35 | 0 rawmode 36 | -------------------------------------------------------------------------------- /languages/treestack/examples/error.tsk: -------------------------------------------------------------------------------- 1 | 3 4 5 2 | ; should give an error at the last . 3 | . . . . 4 | 4 5 6 5 | -------------------------------------------------------------------------------- /languages/treestack/examples/factorial.tsk: -------------------------------------------------------------------------------- 1 | fn factorial { 2 | 1 3 | ; adds one to start the 1..n range 4 | swap 5 | ; swaps the one as before it was after n 6 | range 7 | ; creates the 1..n range 8 | ( 9 | ; kinda evil, but moves into the stack 10 | ; this and the while loop makes sure you don't experience a 11 | ; stack underflow as the while will run even if there is only 12 | ; one value 13 | while { 14 | ) 15 | ; moves back to stack end 16 | * 17 | ; multiples 18 | ( 19 | ; does the same as before while 20 | } 21 | ) 22 | ; moves back to stack end 23 | } 24 | 25 | 10 factorial 26 | . 27 | -------------------------------------------------------------------------------- /languages/treestack/examples/fib.tsk: -------------------------------------------------------------------------------- 1 | ; honestly no clue how this works 2 | fn fib { 3 | -- 4 | 0 1 5 | (( while { 6 | )) 7 | over 8 | over 9 | + 10 | (( drop -- 11 | } )) 12 | } 13 | 14 | 9 fib . 15 | -------------------------------------------------------------------------------- /languages/treestack/examples/file.tsk: -------------------------------------------------------------------------------- 1 | "hello world!" "test.txt" write 2 | ; reads two strings, writes the second one into the file designated by the first 3 | "test.txt" read print 4 | ; just reads from the given string 5 | ; reads as a string kinda? 6 | -------------------------------------------------------------------------------- /languages/treestack/examples/helloworld.tsk: -------------------------------------------------------------------------------- 1 | "hello world!" print 2 | -------------------------------------------------------------------------------- /languages/treestack/examples/rawmode.tsk: -------------------------------------------------------------------------------- 1 | 1 rawmode 2 | ; this is in raw mode, so you can get char-by-char input 3 | 4 | 1 while { 5 | ;input 6 | ? 7 | 8 | ; check for ctrl c 9 | dup 3 = 10 | if { drop 0 } else { drop } 11 | 12 | if { "Pressed Char Code:" print . "\n\r" print } 13 | flush 14 | 15 | 100 sleep 16 | } 17 | 18 | 0 rawmode 19 | -------------------------------------------------------------------------------- /languages/treestack/examples/roguelike.tsk: -------------------------------------------------------------------------------- 1 | &root 0 [ 0, 0 ] 1 [ 3 &x 4 &y ] 2 | 2 [ &screen 20 while { 1 [ 80 while { 1 swap -- } ] swap -- } ] 3 | 4 | fn drawscreen { 5 | ^root ))) 6 | [ 7 | drop 8 | while { 9 | [ drop while { 1 = if { '#' , } else { ' ' , } drop } ] 10 | drop 11 | 10 , 12 | } 13 | ] 14 | } 15 | 16 | fn draw_room { 17 | ^root 18 | ))) 19 | 3 6 random &height 20 | 3 6 random &width 21 | 1 14 random &y 22 | 1 74 random &x 23 | (((( 24 | [ ( 25 | 26 | *y while { swap ( -- } drop 27 | 28 | *height 29 | while { 30 | -- swap 31 | [ ( 32 | 33 | *x while { swap ( -- } drop 34 | 35 | *width 36 | while { 37 | -- swap 1 + ( 38 | } drop 39 | ] ( 40 | } 41 | drop 42 | ] 43 | } 44 | 45 | ^root ) [ 10 &count while { draw_room ^count -- } 46 | drawscreen 47 | -------------------------------------------------------------------------------- /languages/treestack/examples/sort.tsk: -------------------------------------------------------------------------------- 1 | 1[ 1 100 range "drop 1 10 random" map ] 2 | dup . 3 | [ ( while { ) over over > if { drop swap } else { drop } (( } ] 4 | 10 , 5 | . 6 | -------------------------------------------------------------------------------- /languages/treestack/examples/torus.tsk: -------------------------------------------------------------------------------- 1 | fn init_uv { 11 while { &x [ 21 while { dup -- *x swap } ] dup -- shear } } 2 | fn square { dup * } 3 | init_uv 4 | drop 5 | 6 | while { 7 | [ 8 | drop 9 | while { 10 | 6 - square 11 | swap 12 | 11 - 2 / square 13 | + dup 14 | 20 < swap 8 > 15 | + 16 | if { "#" print } else { " " print } 17 | 1 18 | } 19 | 10 , 20 | ] 21 | drop 22 | } 23 | -------------------------------------------------------------------------------- /languages/treestack/operators.md: -------------------------------------------------------------------------------- 1 | # Operators 2 | 3 | ## Simple Operators 4 | `+` plus 5 | 6 | `-` minus 7 | 8 | `/` divide 9 | 10 | `*` multiply 11 | 12 | 13 | `[` enter stack 14 | 15 | `]` exit stack 16 | 17 | `(` move towards the first value pushed to the stack 18 | 19 | `)` move towards the last value pushed to the stack 20 | 21 | 22 | `.` output as number 23 | 24 | `,` output as char 25 | 26 | `?` inputs a char 27 | 28 | `\`` pops top element 29 | 30 | 31 | `++` plus one 32 | 33 | `--` minus one 34 | 35 | `!` not symbol, relies on if value is truthy 36 | 37 | `>`, `<`, `<=`, `>=` regular compare operators 38 | 39 | `=` equals 40 | 41 | ## Pointers 42 | `&` creates a pointer if followed with a name 43 | 44 | `*` pushes the value at the pointer to the current stack 45 | 46 | `^` jumps to the pointer 47 | -------------------------------------------------------------------------------- /languages/treestack/treestack.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | endif 4 | 5 | syntax keyword tskKeyword if else while fn break continue return 6 | highlight link tskKeyword Keyword 7 | 8 | " Integer with - + or nothing in front 9 | syn match tskNumber '\d\+' 10 | syn match tskNumber '[-+]\d\+' 11 | highlight link tskNumber Constant 12 | 13 | syn region tskString start=+"+ end=+"+ skip=+\\"+ 14 | syn region tskString start=+'+ end=+'+ skip=+\\'+ 15 | highlight link tskString Constant 16 | 17 | syn match tskComment ";.*$" 18 | highlight link tskComment Comment 19 | 20 | syn region tskWord start="[a-zA-Z_]" end="[^a-zA-Z_]" 21 | highlight link tskWord Identifier 22 | 23 | " syn region tskFunc start="fn " hs=e+1 end=" "he=s-1 24 | " highlight link tskFunc Type 25 | syn match tskOp "[!&*+%,./<=>?@\\^`|-]" 26 | highlight link tskOp Operator 27 | 28 | syn match tskMove "[\[\]\{}()]" 29 | highlight link tskMove Function 30 | 31 | syn region tskPointer start="[*&\\^][a-zA-Z_]" end="[^a-zA-Z_]"me=e-1 32 | highlight link tskPointer Operator 33 | 34 | let b:current_syntax = "tsk" 35 | -------------------------------------------------------------------------------- /languages/λ/README.md: -------------------------------------------------------------------------------- 1 | # lambda calculus! 2 | 3 | i almost certainly will mess up if i try to give an explanation, so please visit [the wikipedia page](https://en.wikipedia.org/wiki/Lambda_calculus)! 4 | 5 | anyway, i believe this is the first lambda calculus programming language that aims to be an actual programming language. there are interpreters online, but all of those are either for math students or are impure (as in not completely functional). also, keep in mind that my verison has slightly different syntax: 6 | 7 | functions: `λ{variable}.{expression}` 8 | 9 | applications (the parenthesis are important!!): `({expression} {expression})` 10 | 11 | variables: `{singular lowercase letter}` 12 | 13 | there is also no combinator because i think other forms of recursion (such as the one shown in the factorial example program) are better. cheers! 14 | 15 | to run, clone the repo and run `python3 λ.py examples/helloworld.λ` to run the helloworld program! that can be swapped out for any other programs you want to run. 16 | -------------------------------------------------------------------------------- /languages/λ/examples/factorial.λ: -------------------------------------------------------------------------------- 1 | #include churchnums 24 2 | 3 | * = λm.λn.λf.(m (n f)) 4 | -- = λn.λf.λx.(((n λg.λh.(h (g f))) λu.x) λu.u) 5 | 6 | TRUE = λx.λy.x 7 | FALSE = λx.λy.y 8 | IFTHENELSE = λp.λa.λb.((p a) b) 9 | ISZERO = λn.((n λx.FALSE) TRUE) 10 | 11 | FACT = λf.λn.(((IFTHENELSE (ISZERO n)) 1) ((* n) ((f f) (--n)))) 12 | OUT = ((FACT FACT) 4) 13 | -------------------------------------------------------------------------------- /languages/λ/examples/fib.λ: -------------------------------------------------------------------------------- 1 | #import churchnums 100 2 | 3 | + = λm.λn.λf.λx.((m f) ((n f) x)) 4 | -- = λn.λf.λx.(((n λg.λh.(h (g f))) λu.x) λu.u) 5 | 6 | PAIR = λx.λy.λf.((f x) y) 7 | FIRST = λp.(p TRUE) 8 | SECOND = λp.(p FALSE) 9 | 10 | TRUE = λx.λy.x 11 | FALSE = λx.λy.y 12 | IFTHENELSE = λp.λa.λb.((p a) b) 13 | ISZERO = λn.((n λx.FALSE) TRUE) 14 | 15 | FIB = λf.λn.λp.(((IFTHENELSE (ISZERO n)) (SECOND p)) (((f f) (-- n)) ((PAIR (SECOND p)) ((+ (FIRST p)) (SECOND p))))) 16 | 17 | OUT = (((FIB FIB) 7) ((PAIR 1) 0)) 18 | // 7 is the num of iterations, ((PAIR 1) 0) is the starting config, lucas numbers would be ((PAIR 1) 3) 19 | -------------------------------------------------------------------------------- /site/components/Interpreter.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from 'react' 2 | import styles from './Editor.module.scss' 3 | 4 | export default function Interpreter() { 5 | const [output, setOutput] = useState>( 6 | [] 7 | ) 8 | 9 | return ( 10 |
11 |
12 | {output.map((line, idx) => ( 13 | {line.value} 14 | ))} 15 | 16 | > 17 | 18 |
19 |
20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /site/components/Mermaid.tsx: -------------------------------------------------------------------------------- 1 | import mermaid from 'mermaid' 2 | import { useEffect } from 'react' 3 | 4 | mermaid.initialize({ 5 | startOnLoad: true, 6 | theme: 'default', 7 | securityLevel: 'none' 8 | }) 9 | 10 | type MermaidProps = { 11 | readonly chart: string 12 | } 13 | 14 | export default function Mermaid({ chart }: MermaidProps): JSX.Element { 15 | useEffect(() => { 16 | mermaid.contentLoaded() 17 | }, []) 18 | 19 | return ( 20 |
21 |
{chart}
22 |
23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /site/components/easel.grammar: -------------------------------------------------------------------------------- 1 | @top File { (Identifer | Number | String)+ } 2 | 3 | @skip { space } 4 | 5 | @tokens { 6 | space { @whitespace+ } 7 | Identifer { $[A-Za-z_]+ } 8 | Number { $[0-9]+ } 9 | String { '"' !["]* '"' } 10 | } 11 | 12 | @external propSource highlighting from "./highlight.js" 13 | -------------------------------------------------------------------------------- /site/components/easel.js: -------------------------------------------------------------------------------- 1 | import { LRParser } from '@lezer/lr'; 2 | import { styleTags, tags } from '@lezer/highlight'; 3 | 4 | const highlighting = styleTags({ 5 | Identifer: tags.name, 6 | Number: tags.number, 7 | String: tags.string 8 | }); 9 | 10 | // This file was generated by lezer-generator. You probably shouldn't edit it. 11 | const parser = LRParser.deserialize({ 12 | version: 14, 13 | states: "hOVQPOOOOQO'#Ca'#CaQVQPOOOOQO-E6_-E6_", 14 | stateData: "b~OWOS~OQPORPOSPO~O", 15 | goto: "]UPPPPPVQQORRQ", 16 | nodeNames: "⚠ File Identifer Number String", 17 | maxTerm: 8, 18 | propSources: [highlighting], 19 | skippedNodes: [0], 20 | repeatNodeCount: 1, 21 | tokenData: "#z~R_X^!Qpq!Qrs!u!Q![#d!c!}#l#R#S#l#T#o#l#y#z!Q$f$g!Q#BY#BZ!Q$IS$I_!Q$I|$JO!Q$JT$JU!Q$KV$KW!Q&FU&FV!Q~!VYW~X^!Qpq!Q#y#z!Q$f$g!Q#BY#BZ!Q$IS$I_!Q$I|$JO!Q$JT$JU!Q$KV$KW!Q&FU&FV!Q~!xTOr!urs#Xs;'S!u;'S;=`#^<%lO!u~#^OS~~#aP;=`<%l!u~#iPR~!Q![#d~#qRQ~!c!}#l#R#S#l#T#o#l", 22 | tokenizers: [0], 23 | topRules: {"File":[0,1]}, 24 | tokenPrec: 0 25 | }); 26 | 27 | export { parser }; 28 | -------------------------------------------------------------------------------- /site/components/highlight.js: -------------------------------------------------------------------------------- 1 | import { styleTags, tags } from '@lezer/highlight' 2 | 3 | export const highlighting = styleTags({ 4 | Identifer: tags.name, 5 | Number: tags.number, 6 | String: tags.string 7 | }) 8 | -------------------------------------------------------------------------------- /site/components/interactive/Lexer.module.scss: -------------------------------------------------------------------------------- 1 | .tokens { 2 | max-width: calc(100vw - ((100vw - 60vw) / 2)) !important; 3 | width: calc(100vw - ((100vw - 60vw) / 2)) !important; 4 | overflow-x: auto; 5 | height: 100%; 6 | } 7 | 8 | .token { 9 | // border: 1px dotted var(--border); 10 | // padding: 7px 12px; 11 | // transition: all 0.1s; 12 | // cursor: help; 13 | position: relative; 14 | 15 | .popover { 16 | border: 1px dotted var(--theme); 17 | font: inherit; 18 | background-color: white; 19 | position: absolute; 20 | top: 80%; 21 | left: 80%; 22 | z-index: 999; 23 | padding: 7px 12px; 24 | 25 | p { 26 | margin: 0; 27 | } 28 | } 29 | 30 | &:hover { 31 | border-color: var(--theme); 32 | // box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.05); 33 | 34 | > code { 35 | font-weight: 500; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /site/components/interactive/Node.module.scss: -------------------------------------------------------------------------------- 1 | .node { 2 | border: 2px solid var(--theme); 3 | // width: fit-content; 4 | margin: 1em 0; 5 | 6 | > div { 7 | padding-inline: 1rem; 8 | 9 | p { 10 | margin: 0 !important; 11 | text-align: center; 12 | } 13 | } 14 | 15 | > div:nth-child(1) { 16 | border-bottom: 2px dotted var(--theme); 17 | text-align: center; 18 | } 19 | 20 | > div:nth-child(2) { 21 | padding: 1rem; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /site/components/interactive/Node.tsx: -------------------------------------------------------------------------------- 1 | import React, { PropsWithChildren } from 'react' 2 | import styles from './Node.module.scss' 3 | 4 | export default function Node({ 5 | children, 6 | title 7 | }: { 8 | children: any 9 | title: string 10 | }) { 11 | return ( 12 |
13 |
14 |
{title}
15 |
{children}
16 |
17 |
18 | ) 19 | } 20 | -------------------------------------------------------------------------------- /site/components/interactive/Pancakes.module.scss: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | font-family: 'Virgil'; 3 | display: flex; 4 | border: 3px solid black; 5 | border-top-left-radius: 255px 15px; 6 | border-top-right-radius: 15px 225px; 7 | border-bottom-right-radius: 225px 15px; 8 | border-bottom-left-radius: 15px 255px; 9 | height: 500px; 10 | 11 | h2 { 12 | font-family: 'Virgil' !important; 13 | } 14 | } 15 | 16 | .recipe { 17 | padding: 1rem; 18 | overflow: auto; 19 | } 20 | 21 | .select { 22 | border-right: 2px solid black; 23 | flex: 1; 24 | height: 100%; 25 | 26 | > div { 27 | padding: 1rem; 28 | cursor: pointer; 29 | 30 | &:not(:nth-child(1)) { 31 | border-top: 2px solid black; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /site/components/invalidBirthdate.ts: -------------------------------------------------------------------------------- 1 | export function calculateMinDate() { 2 | const currentDate = new Date() 3 | const maximumAge = 19 4 | currentDate.setFullYear(currentDate.getFullYear() - maximumAge) 5 | return currentDate 6 | } 7 | 8 | export default function invalidBirthdate(date: string) { 9 | const minDate = calculateMinDate() 10 | if (minDate < new Date(date)) return false 11 | return true 12 | } 13 | -------------------------------------------------------------------------------- /site/components/parser.js: -------------------------------------------------------------------------------- 1 | // This file was generated by lezer-generator. You probably shouldn't edit it. 2 | import {LRParser} from "@lezer/lr" 3 | export const parser = LRParser.deserialize({ 4 | version: 14, 5 | states: "hOVQPOOOOQO'#Ca'#CaQVQPOOOOQO-E6_-E6_", 6 | stateData: "b~OWOS~OQPORPOSPO~O", 7 | goto: "]UPPPPPVQQORRQ", 8 | nodeNames: "⚠ File Identifer Number String", 9 | maxTerm: 8, 10 | skippedNodes: [0], 11 | repeatNodeCount: 1, 12 | tokenData: "#z~R_X^!Qpq!Qrs!u!Q![#d!c!}#l#R#S#l#T#o#l#y#z!Q$f$g!Q#BY#BZ!Q$IS$I_!Q$I|$JO!Q$JT$JU!Q$KV$KW!Q&FU&FV!Q~!VYW~X^!Qpq!Q#y#z!Q$f$g!Q#BY#BZ!Q$IS$I_!Q$I|$JO!Q$JT$JU!Q$KV$KW!Q&FU&FV!Q~!xTOr!urs#Xs;'S!u;'S;=`#^<%lO!u~#^OS~~#aP;=`<%l!u~#iPR~!Q![#d~#qRQ~!c!}#l#R#S#l#T#o#l", 13 | tokenizers: [0], 14 | topRules: {"File":[0,1]}, 15 | tokenPrec: 0 16 | }) 17 | -------------------------------------------------------------------------------- /site/components/parser.terms.js: -------------------------------------------------------------------------------- 1 | // This file was generated by lezer-generator. You probably shouldn't edit it. 2 | export const 3 | File = 1, 4 | Identifer = 2, 5 | Number = 3, 6 | String = 4 7 | -------------------------------------------------------------------------------- /site/components/trim.ts: -------------------------------------------------------------------------------- 1 | export const trim = (str, chars) => str.split(chars).filter(Boolean).join(chars) 2 | -------------------------------------------------------------------------------- /site/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | typescript: { 4 | ignoreBuildErrors: true 5 | }, 6 | experimental: { 7 | serverActions: { 8 | bodySizeLimit: '50mb' 9 | } 10 | }, 11 | async redirects() { 12 | return [ 13 | { 14 | source: '/', 15 | destination: '/orpheus-finds-easel', 16 | permanent: true 17 | } 18 | ] 19 | } 20 | } 21 | 22 | export default nextConfig 23 | -------------------------------------------------------------------------------- /site/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import '@/styles/globals.scss' 2 | import type { AppProps } from 'next/app' 3 | import Script from 'next/script' 4 | import Meta from '@hackclub/meta' 5 | import Head from 'next/head' 6 | 7 | export default function App({ Component, pageProps }: AppProps) { 8 | return ( 9 | <> 10 |