Git Product home page Git Product logo

krypton's Introduction

Krypton

Krypton is a flexible yet statically typed language for quick scripts. It directly supports rational number (i.e. fractions) and complex numbers.

At this point, it can't do anything. But it is gonna grow and become something, I promise ^^

Some syntactic impression ^^ (I'm using visual basic for syntax highlighting. It doesn't work 100%, but this language most closely matches Krypton's syntax)

Out "Hello world uwu"; ... Outputs "Hello world uwu"

Var complex As Complex = 3 + 4i;
Out complex; ... "3 + 4i"
Out complex.Real; ... "3"
Out complex.Imag; ... "4"
Out complex.Magnitude; ... "5"

Var fraction As Rational = 1 Over 2;
Out fraction; ... "1/2"
Out fraction.Numerator; ... "1"
Out fraction.Denominator; ... "2"

Var fraction2 = 2 Over 4; ... As can be left out
Out fraction2; ... "1/2"

Var input As String = Input();
If (input Is x As Int)
{
        Out x ** 2; ... Squares the input
}
Else
{
        Out "Please enter an integer";
}

Keep in mind, that almost nothing about Krypton's syntax is set in stone yet. This is a prototype!

krypton's People

Stargazers

 avatar

Watchers

 avatar

krypton's Issues

refactoring todo v2

  • add internal where due
  • add DebuggerDisplay and similar attributes
  • Krypton.Analysis.Ast into own assembly?
  • figure out namespace for some types:
    • FrameworkIntegration into Kr.Anl.Semantical?
    • ILoopNode into Kr.Anl.Ast? Or IReturnableNode into Kr.Anl.Ast.Statements?
    • move all in Kr.Anl.Sem.IdMaps into Kr.Anl.Sem?

js internal operator names

Operator Name
** "expon"
* "mul"
/ "rdiv"
Mod "mod"
+ "plus"
binary - "minus"
< "less"
<= "leq"
>= "geq"
> "gre"
== "eq"
!= "neq"
unary - "neg"

Refactoring todo

  • Rename and move class Krypton.Analysis.Ast.SyntaxTree to Krypton.Analysis.Compilation? Or AnalysisResult?
  • Rename folder "AST" to "Ast"
  • Rename namespace Krypton.Analysis.Grammatical to Krypton.Analysis.Syntactical
  • Make classes Krypton.Analysis.Syntactical.ExpressionParser, Krypton.Analysis.Syntactical.StatementParser and Krypton.Analysis.Semantical.Binder partial and split them into multiple files
  • Rename short variable names like id instead of identifier or var instead of variable to the longer version
  • Evaluate public members of nodes (some end in *Node, some don't and it's inconsistent)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.