GithubHelp home page GithubHelp logo

hexalang / hexa Goto Github PK

View Code? Open in Web Editor NEW
93.0 10.0 9.0 4.3 MB

:bowtie: Compiler, standard library & backends

Home Page: https://hexalang.github.io

License: GNU Lesser General Public License v3.0

Batchfile 0.14% Shell 0.04% C++ 5.76% Assembly 0.01% C 1.81% JavaScript 0.08% Inno Setup 0.45% TypeScript 91.72%
compiler hexa language programming-language magic hexalang javascript transpiler cross-platform osdev gamedev

hexa's Introduction

Hexa

Her name is [Geksa]

Telegram Chat Discord GitHub Feed Blog Book Website

Hexa is a high level, strictly typed programming language that compiles to JavaScript and native apps

Try Hexa online without installation

GitHub Sponsor Patreon Donate Telegram feed

Key features of Hexa

  • JavaScript-inspired syntax and behavior, feel yourself like at home!
  • Native performance with static types and optimizing compiler
  • Follows node.js (and browser) API
  • Fast compilation
  • Compiles to JavaScript, WebAssembly, osdev, LLVM, C, C++, ObjC, ... you name it! (WIP)
  • Transpilation to almost anything: Lua, AutoCAD Lisp, C#, PHP, etc (WIP)
  • Produces human-readable code for all targets
  • Null safety, crash resistance, pattern matching, classes (WIP)
  • Real multithreading, parallelism, async\await, no GC (WIP)
  • Smart type inference makes other typed languages look boring
  • Friendly and helpful error messages
  • Supports #!shebang and scripting (just call hexa script.hexa)
  • REPL (enable with just hexa command)
  • Metaprogramming with syntax-tree, generics and contracts (WIP)
  • Completely cross-platform
  • We are working on optional memory ownership model (similar to borrow checker) and side effects system (WIP)

WIP — Work in progress, coming soon

Download

  • kawaii is the development branch and accepts pull requests
  • artifacts are built from each kawaii branch commit

Stable

Unstable

Tools & IDE

AI Autocomplete

Install Codeium then open .hexa file and confirm experimental Hexa support.

Study

Build

You need to download latest long-term Node.js LTS. The Hexa Compiler is written in Hexa itself. Pre-built compiler (bootstrapper) already included in the repo.

git clone --recursive --depth 100 https://github.com/hexalang/Hexa.git
cd Hexa
node bootstrap.js hexa.json
node hexa-node.js hexa.json
# This results in a `hexa-node.js` file in the root of the repo
# Call `node hexa-node.js project.json` to build your projects

You may now add the folder into your PATH.

Learn more about compiler development

License

See LICENSE files for full license texts and headers of each file (files in same directory may use different licensing models). If license is not mentioned in header then LICENSE file in upper directory level to be considered.

Compiler and some tools are under Lesser GPL 3.0 (feel free to include as a library in closed source projects), standard libraries and examples are under MIT.

hexa's People

Contributors

acidicmercury8 avatar ethanolchik avatar expwez avatar gitter-badger avatar peyty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar

hexa's Issues

Hexa 2.0.0 MVP

Is your feature request related to a problem? Please describe

The problem is that we still not have proper release

Describe the solution you'd like

Must have an installer at least for Windows, and .deb/.dmg for others is possible

Describe alternatives you've considered

Currently we share artifacts

Describe the possible impacts for development

Well, huge, for newcomers

Additional context

Must at least build Tofita kernel and have working language server

Agreements

So what with Hexa?

I am often asked: what is Hexa and how it differs than language-xyz?

Some examples:

how hexa will be better than haxe? What to purpose of this Lang?

https://twitter.com/JMichaelShlomo/status/828918031686520833

It IS a creazy idea.

https://groups.google.com/d/msg/haxelang/zGLnwJRaThU/tEckOyt6iy8J

curious - what problem(s) are you trying to solve?

https://twitter.com/jeff__ward/status/624432601210601472

Some links from deep multi-year history of the project:

Results? Well...

What exactly have you done? i cant see anything.

https://groups.google.com/d/msg/haxelang/zGLnwJRaThU/hOO4Ohmj7acJ

So I want to announce a short blog posts series about design decisions, experiments and so on.
They are always available via https://hexalang.github.io/blog. Follow https://twitter.com/hexalang for updates.

And feel free to comment!

Syntax and Inspiration

Hello youse! 😄

This is the beginning of my blog post series about Hexa so let us start from basics!

First of all, Hexa was greatly inspired by JavaScript. It consists of things people enjoy, want, find useful and choose to be implemented.
Also, JavaScript has a most flexible yet sane syntax.

Other guys involved are: TypeScript, Swift and, of course, Haxe.

TypeScript's popularity shows that dynamic typed scripting fades away. I love types. It solves a JavaScript+Types problem for me.

Swift's team achieved high level of familiarity while rolled some pretty interesting, somewhat new, sometimes innovative, concepts and features. And yes, there is Apple's tyranny in language space on their platforms, which makes Swift widely used "by default". This is my second lowest common denominator for language look and feel.

Haxe is more than 10 years old language. Ahead of its time, years before it already looked like the todays mainstream. Haxe's main powers are astonishing type system, multiplatfrom support, meta-programming and KISS principle. It also follows JavaScript similarity.

You may expect a mix of features from those languages. Like argument labels at a caller side, nullability control, tagged unions, object extractors, standard library, selective data immutability, etcetera.

As a mostly-systems programmer, I am surely under some influence of C++, Rust, Go, D, Nim, Red, Dafny, Haskell, Ada and maybe others too.

Stay tuned!

Bootstrap the compiler

It was a long standing project and hard research! So it is the time to stop over-engineering and dive into implementation and dogfooding.

Current task is to go wild and make Hexa a self-contained, i.e. self compilable.

Unfortunately, the easiest way to achieve this is to make a compiler prototype in Haxe, convert it's source to Hexa, compile it with Haxe's to finally generate Hexa's compiler, to ..well ..finally compile Hexa compiler with Hexa compiler. Sounds non-trivial, huh?

Actually, Haxe allows to implement automatic source conversion with macro API. So most of the time I am writing Haxe code, which compiles Hexa code, generated from this code which parses this same code. Meh.

This shows to work really well, so lets fill a to-do. Also you may expect the macro to be published in the https://github.com/hexalang/toHexa repo. I don't believe it will directly re-compile something like OpenFL but who knows.

By the way this makes unit testing a lot simpler cause one may reuse Haxe' unit tests he-he.

  • Proof of concept and investigation
  • Complete source-to-source converter
  • Bootstrap over node.js
  • Clean up
  • Publish

Simulate language server in tests

Is your feature request related to a problem? Please describe

Language server is not auto-tested in any way currently

Describe the solution you'd like

Add simulation tests similar to how TestParser does: run lint over a code sample and compare to the desired server output

Describe alternatives you've considered

Not doing anything, cause we normally use server a lot anyway while coding in Hexa

Describe the possible impacts for development

We could add this into CI, also helps to validate compatibility regressions

Additional context

Those tests should not go into release builds, and maybe use json files to describe output (ohh, maybe use objects in code, cause they are typed)

Agreements

Unknown command, when executing hexa built with Nexe

Describe the bug

I'm getting an error when I execute hexa built with Nexe, it's telling me something about Unknown command, suggesting that something is being sent as an argument upon execution by default?

Reproduction

I cloned the repo executed the main build script for the bootstrapped compiler

$ .\build.bat

it went great.... now when I compiled to Nexe using:

$ .\nexe-build.bat

It successfully built the executable, but when I run it, it outputs this:

PS C:\Users\showheyhey\Documents\GitHub\hexa> hexa.exe
Unknown command: C:\Users\showheyhey\Documents\GitHub\hexa\hexa-node.js
Try `hexa help`
Hexa 2023.1.6 on node.js 14.15.3

Platform

  • Laptop
  • Windows 11 (x64)

Expected behavior

Clean execution with no errors.

Screenshots

No response

Additional context

No response

Agreements

Cannot Bulid in Artix Linux

Hello, Im Try to Build hexa compiler for greentea os, i can not complate compile and see error:

/home/mobin/AUR/hexa/bootstrap.js:8331
throw new CompilerErrors(this.hints);
^
CompilerErrors {
errors: [
CompilerError {
exception: 0,
details: 'Expected case before return',
line: 191,
column: 9,
fileName: '/home/mobin/AUR/hexa/source/compiler/normalizer.hexa'
}
]
}
[mobin@Mobin-Mahdi-PC hexa]$

I think this problem is due to incorrect programming. Unfortunately I am not fluent in JavaScript. Thank you for helping me :)

My PC:
CPU= AMD Ryzen 5 3500X
GPU= NVIDIA Geforce GTX 1650
RAM= 2x8GB (16GB) CL16 - DDR4
OS= Artix Linux (Arch Linux + OpenRC init)

More CI tests

Progress

  • node --trace-uncaught
  • Other tests
  • CI failure on tests build failure
  • msbuild aka MSVC of win32/posix demos.
    • Must use C (not C++) with C11 standard, if possible.
    • Should also build with C++11 and C++2x (latest standard) modes (for regressions)
    • 32-bit and 64-bit
  • CI failure on msbuild failure
  • CI logs should provide Hexa compiler stdout/stderr (like [Building The Hexa Compiler]...)
  • Timeouts for builds (sometimes build may go infinite loop). For example 3 minutes should be enough for now.
  • Add Linux (64-bit) and macOS (with Xcode enabled) builds/artifacts, possibly within one action build-all
  • Merge libgen build into one action if it makes sense (separate build block within build-all for parallel)
  • Parallel execution of all build tasks
  • Action test-all which takes artifacts from build-all (if build-all succeeded) and builds tests from 2.
  1. All node.exe invocations should use --trace-uncaught as the first argument like this --trace-uncaught bootstrap.js hexa.json. Node is very conservative on error origins without that feature.
  2. More tests should be built after bootstrapping process:
test/lts/hello/hexa.json
examples/html-raytracer/hexa.json
test/normalizer/hexa.json
examples/node-platform/hexa.json
examples/native-win32/hexa.json
examples/native-posix/hexa.json + build the output (macos clang, windows msvc, linux gcc) (NO artifact needed)
  1. CI should stop on any build error. Hexa reports non-zero error code on fail, zero on success.
  2. Build examples/native-win32/win32.c (build only) with MSVC (like libgen). It is produced from examples/native-win32/hexa.json. Same for POSIX demo.
  3. CI should stop on any MSVC build error.

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.