Giter Site home page Giter Site logo

vcfxb / wright-lang Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 3.0 1.87 MB

The wright programming language (WIP)

Home Page: https://wright.venusblon.de/

License: MIT License

Rust 99.22% HTML 0.78%
programming-language wright wright-programming-language rust language wright-language programming programming-languages

wright-lang's People

Contributors

dependabot-preview[bot] avatar io12 avatar kvverti avatar vcfxb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wright-lang's Issues

WebAssembly

Does the compiler run on WebAssembly (wasm)? Is such feature planned?

AstEq trait

Tracking issue for AstEq trait that compares AST nodes but ignores fragments.

Conditional Expression parser

Conditional expression parser tracking issue.

Syntax should be along the lines of

"if", expr, block, ("else", "if", expr, block)*, ["else", block] 

Targets

This is pretty far in the future, but I'll leave some platforms I'm considering targeting here, to look back at for reference later:

  • C
  • JVM
  • LLVM
  • Cretonne (If it still exists.)
  • Rust (maybe?)
  • MIPS (or some subset)
  • Brainfuck (maybe?)
  • WASM (maybe?)

Block Parser

Block ::= "{" [[Expression [";"]] "}"

Notes:

  • Blocks do not need an expression list because the semicolon ; is a binary operator.
  • The unit value (of the type void) might be expressed as {}.

Treating blocks as expressions that return the value of Expression poses a parsing question: should blocks be valid anywhere an expression is? Examples include

3 + { "hello"; 4 }
func(3, { 2; 1 })

In this case, if ; keeps being an operator, blocks have the same grouping properties as parentheses ().

3 + ("hello"; 4)
func(3, (2; 1))

Should parenthesized expressions also be considered blocks by the grammar?

Error module

Finishing up the error module and writing unit tests.

Wright Expression Precedence

Here is a list of applicable Wright expressions with in suggested precedence order.

{
  a::b; // scope resolution
  a.b; // member access
  a..b; // half open range
  a * b / c % d // multiplication/division/remainder
  a + b - c; // addition/subtraction
  a & b; // bitwise and
  a ^ b; // bitwise/logical xor
  a | b; // bitwise or
  a && b; // logical and
  a || b; // logical or
  a < b > c <= d >= e; // comparison
  a == b != c; // equality
  a = b; // assign
  let a = b; // variable creation and jump expressions (e.g. return)
}

This order follows the precedence order in C-like languages, with the additions of variable creation and jump expressions binding at the lowest precedence.

Expressions like { a } and if a { b } else { c } don't need precedence because they do not expose a bare expression at the head or the tail.

The Semicolon Operator and Expression Categories

Currently, the semicolon ; (used to sequence expressions) is a binary operator. However, in some cases, treating ; this way results in weird-looking code. For example,

func(1, 2; 3, 4)

would be equivalent to

func(1, 3, 4)

As well, this creates ambiguity with the hypothetical variable declaration

"let" Identifier "=" Expression

If Expression is a semicolon-expression.

let x = 5; 3
(let x = 5); 3
let x = (5; 3)

Some of the weirdness could be solved by having different categories of expressions for each of these cases, e.g. NonSemicolonExpression, ExpressionOrVariableDecl.

Multiline comments

Once #18 is merged we will need to add on to and modify it to also work for multiline comments. This is the tracking issue for that.

Type System

Tracking issue for the wright type system and type parsers

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.