-login:
user: password:
Polski
huginn - programming language with no quirks, so simple every child can master it.
Fork me on GitHub
git clone https://codestation.org/repo/huginn.git
git clone https://github.com/AmokHuginnsson/huginn.git
git clone https://bitbucket.org/huginn/huginn.git
  1. Syntax
  2. Keywords
  3. Types

    Huginn provides several built-in scalar and collection types, as well as user defined compound types.

    integer real string number character boolean list deque dict order lookup set
  4. Built-ins
  5. Core library classes
  6. Packages
  • huginnGrammar = +( classDefinition | functionDefinition | importStatement )
  • classDefinition = ( "class" >> identifier >> -( ':' >> identifier ) >> '{' >> +( field | functionDefinition ) >> '}' )
  • functionDefinition = ( identifier >> callable )
  • importStatement = ( "import" >> identifier >> "as" >> identifier >> ';' )
  • field = ( identifier >> '=' >> expression >> ';' )
  • callable = ( '(' >> -(
    ( nameList >> -( ',' >> variadicParameter ) >> -( ',' >> namedParameterCapture ) )
    | ( variadicParameter >> -( ',' >> namedParameterCapture ) )
    | namedParameterCapture ) >>
    ')' >> '{' >> *statement >> '}' )
  • expression = ( *( ( assignable >> *( ',' >> assignable ) >> ( "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "^=" ) ) ^ '=' ) >> value )
  • nameList = ( parameter >> *( ',' >> parameter ) )
  • variadicParameter = ( identifier >> "..." )
  • namedParameterCapture = ( identifier >> ":::" )
  • statement = ( ifStatement
    | whileStatement
    | forStatement
    | switchStatement
    | tryCatchStatement
    | throwStatement
    | breakStatement
    | continueStatement
    | returnStatement
    | expressionStatement
    | scope )
  • assignable = ( subscript | identifier )
  • value = ternary
  • parameter = ( ( identifier ^ ( "..." | ":::" ) ) >> -( '=' >> expression ) )
  • ifStatement = ( ifClause >> *( "else" >> ifClause ) >> -( "else" >> scope ) )
  • whileStatement = ( "while" >> '(' >> expression >> ')' >> scope )
  • forStatement = ( "for" >> '(' >> assignable >> *( ',' >> assignable ) >> ':' >> expression >> ')' >> scope )
  • switchStatement = ( "switch" >> '(' >> expression >> ')' >> '{' >> +caseStatement >> -defaultStatement >> '}' )
  • tryCatchStatement = ( "try" >> scope >> +catchStatement )
  • throwStatement = ( "throw" >> expression >> ';' )
  • breakStatement = ( "break" >> ';' )
  • continueStatement = ( "continue" >> ';' )
  • returnStatement = ( "return" >> -( '(' >> expression >> ')' ) >> ';' )
  • expressionStatement = ( expression >> ';' )
  • scope = ( '{' >> *statement >> '}' )
  • subscript = ( identifier >> +( subscriptOperator | functionCallOperator | memberAccess ) )
  • ternary = ( ( booleanOr >> -( "^^" >> booleanOr ) ) >> -( '?' >> expression >> ':' >> expression ) )
  • ifClause = ( "if" >> '(' >> expression >> ')' >> scope )
  • caseStatement = ( "case" >> '(' >> expression >> ')' >> ':' >> scope >> -breakStatement )
  • defaultStatement = ( "default" >> ':' >> scope )
  • catchStatement = ( "catch" >> '(' >> identifier >> assignable >> ')' >> scope )
  • subscriptOperator = ( '[' >> ( ( ( rangeOper >> -argument ) | ( argument >> -( rangeOper >> -argument ) ) ) >> -( rangeOper >> -argument ) ) >> ']' )
  • functionCallOperator = ( '(' >> -argList >> -( ',' >> namedParameters ) ) | namedParameters ) >> ')' )
  • memberAccess = ( '.' >> identifier )
  • booleanOr = ( booleanAnd >> *( ( "||" | "⋁" ) >> booleanAnd ) )
  • rangeOper = ':'
  • argument = expression
  • argList = ( argument >> *( ',' >> argument ) )
  • namedParameters = ( namedParameter >> *( ',' >> namedParameter ) )
  • booleanAnd = ( equality >> *( ( "&&" | "⋀" ) >> equality ) )
  • functionArgument = ( ( argument ^ ':' ) >> -"..." )
  • namedParameter = ( identifier >> ':' >> functionArgument )
  • equality = ( compare >> -( ( "==" | "!=" ) >> compare ) )
  • compare = ( sum >> -( ( "<=" | ">=" | "<" | ">" ) >> sum ) )
  • sum = ( multiplication >> *( '+-' >> multiplication ) )
  • multiplication = ( power >> *( '*/%' >> power ) )
  • negation = ( ( '-' >> negation ) | power )
  • power = ( booleanNot >> *( '^' >> negation ) )
  • booleanNot = ( ( '!' >> factorial ) | factorial )
  • factorial = ( atom >> -( ( '!' & "==" ) | ( '!' ^ '=' ) ) )
  • atom = ( absoluteValue
    | ( parenthesis >> -( memberAccess >> dereference ) )
    | real | integer
    | ( ( numberLiteral | character_literal ) >> -( memberAccess >> functionCallOperator ) )
    | ( ( tupleLiteral | listLiteral | dictLiteral | lookupLiteral | stringLiteral ) >> -( ( subscriptOperator | memberAccess ) >> dereference ) )
    | ( setLiteral >> -( memberAccess >> dereference ) )
    | none | true | false
    | ( identifier >> dereference )
    | ( lambda >> -( functionCallOperator >> dereference ) ) )
  • absoluteValue = ( '|' >> expression >> '|' )
  • parenthesis = ( '(' >> expression >> ')' )
  • dereference = *( subscriptOperator | functionCallOperator | memberAccess )
  • numberLiteral = ( '$' >> real )
  • tupleLiteral = ( '(' >> -argList >> -',' >> ')' )
  • listLiteral = ( '[' >> -argList >> ']' )
  • dictLiteral = ( '[' >> -( dictLiteralElement >> *( ',' >> dictLiteralElement ) ) >> ']' )
  • lookupLiteral = ( '{' >> -( dictLiteralElement >> *( ',' >> dictLiteralElement ) ) >> '}' )
  • stringLiteral = string_literal
  • setLiteral = ( '{' >> argument >> *( ',' >> argument ) >> '}' )
  • none = "none"
  • true = "true"
  • false = "false"
  • lambda = ( ( '@' >> -( '[' >> caprureList >> ']' ) ) >> callable )
  • dictLiteralElement = ( argument >> ':' >> argument )
  • caprureList = ( capture >> *( ',' >> capture ) )
  • capture = ( identifier >> -( ':' >> expression ) )
  • identifier = regex( "\b[a-zA-Z\x{0391}-\x{03c9}_][a-zA-Z\x{0391}-\x{03c9}0-9_]*\b" )