Package: talonlang
The Talon Programming LanguageTalon is a toy programming language with Python and JavaScript flavors.fun factorial(n) {
  if (n == 1) {
    ret 1
  } else {
    ret n * factorial(n - 1)
  }
}

this f = factorial(4)

print(f) // -> 24this name = getstr('What is your name? ')
this length = len(name)

printf('Your name is %0; it has %1 characters.', [name, length])You can view more demos in theexamplesfolder.Running and Compiling CodeFirst you must install Talon.pipinstalltalonlangThen you can run Talon programs:tal[-c]<input.tal[c]>[-o<output.talc>]The-cswitches on compiling. If no-oflag is provided (along with a filename), the output file will be named according to the input file. Eg.input.taltoinput.talc. (Note: you may compile already compiled code, but that is redundant and pointless.)The-oflag changes the name of the output file. It can only be used if-cis present.If the-cflag is not included, the interpreter will eithercompile and run the provided code if the file ends in.tal,or interpret the compiled code if the file extension is.talc.Basic SyntaxA basic rundown of Talon's syntax.CommentsSingle line:// I'm a comment
print('Hello') // Another commentMulti-line:/*
  This is a multi-line comment.
  It can cover multiple lines.
*/VariablesVariables are initialized with thethiskeyword:this foo = barLike in JavaScript, values arenotrequired when first initializing a variable:this xHowever, re-initializing a variable results in an error:this name = 'Talon'
this name // ERRORAssignment can be accomplished via a variety of operators:this n
n = 1
n += 2    // n = n + 2
n -= 5    // n = n - 5
n *= 7    // n = n * 7
n /= 1.5  // n = n / 1.5
n %= 3    // n = n % 3
n ^= 20   // n = n ^ 20ValuesNumbersInteger:42,1,-67Float:3.1415,98.6,-1.168StringsSingle-quoted:'Hello!'Double-quoted:"Good day!"BooleansTruthy:true,on,yesFalsey:false,off,noListsCreatingSingle dimensional:[1, 2, 3, 4]Multi-dimensional:[[1, 2], [3, 4]]Accessing:list[index],list[index][index2]Slicing:list[:-1],list[1:],list[2:-2]RangesInclusive:1 to 10Exclusive:1 upto 11OperatorsBinaryAddition:a + bSubtraction:a - bMultiplication:a * bDivision:a / bModulus:a % bExponent:a ^ bUnaryNegation:-xAbsolute value:+xNot:!xComparingEquals:a == bNot equals:a != bLess than:a < bGreater than:a > bLess than or equal to:a <= bGreater than or equal to:a >= bBooleanAnd:a && bOr:a || bConditional Statementsif (/* condition */) {
  ...
} else if (/* condition */) {
  ...
} else {
  ...
}LoopsWhile loop:this i = 0

while (i < 10) {
  print(i)
  i += 1
}For loop:this i

for (i in 1 to 10) {
  print(i)
}this alphabet = 'abcdefghijklmnopqrstuvwxyz'
this letter

for (letter in alphabet) {
  printf('The letter is %0.', [letter])
}FunctionsFunctions can be created by a variety of methods:fun foo(bar) {
  ret bar * 2
}this foo = fun (bar) {
  ret bar * 2
}this foo = (bar) -> {
  ret bar * 2
}this foo = (bar) -> (bar * 2)They have their own scope:fun scope() {
  this x = 2
  x = 5
  y = 6
}

this x = 1
this y = 1

scope()

print(x, y) // 1, 6ImportsCurrently very limited, importing allows you to import functions and variables from other Talon scripts.// a.tal

import('b.tal')

print(add(1, 2)) // 3// b.tal

fun add(a, b) {
  ret a + b
}Hopefully namespaces (which aren't yet supported) will be implemented in the future.import('b.tal', 'b')

print(b.add(1, 2))