Skip to content

Weasel language is a project i created to proof of concept that we can support heterogeneous internally inside a language.

License

Notifications You must be signed in to change notification settings

zaen-archive/weasel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weasel Language

Weasel Language named after name of animal https://en.wikipedia.org/wiki/Weasel

BACKGROUND

Weasel language is a project i created to prove of concept that we can support heterogenous internally inside a language. We can use GPGPU Computing directly supported by the language. Which mean you just directly code to the language and just works.

And we can create computationally task easyly solved. Like Machine Learning and even AI, because you can switch which program or code need to run on GPU or CPU or any compute hardware without hassle.

We also can binding the library created by weasel language into another languages like python to create better environment for end user to create fast program.

SETUP (see LLVM Documentation)

  • Add LLVM Project
  • Before build change linker to llvm lld then Build LLVM Project
  • Set LLVM DIR
  • Build Project

Installing Weasel Language

Linux Version

Windows Version

  • No binary release for windows, follow installing from source code.

Mac OS X

  • no binary release for mac os x, follow installing from source code.

Install from Source Code

1. Install Clang

Untuk linux

  • anda tinggal run
  • sudo apt update
  • sudo apt install clang-12

Untuk Windows

Untuk Mac OS X

  • Clang merupakan default compiler di Mac OS X, jadi tidak perlu menginstall lagi

2. Clone Project

3. Set LLVM DIR

Untuk Linux

  • Tidak perlu diganti

Untuk Windows

  • Buka file CMakeLists.txt
  • Ganti pathnya LLVM_DIR ke {folder clang}/lib/cmake/llvm

Untuk Mac OS X

-Set ke folder cmake llvm (not tested, limited hardware resource)

4. Set Library LLVM SPIRV

Untuk Linux

Untuk Windows

Untuk Mac OS X

5. Build Source

Untuk Linux

  • mkdir build
  • cd build
  • cmake ..
  • cmake --build .
  • tunggu process selesai dan anda bisa menggunakan file executablenya

Untuk Windows

  • mkdir build
  • cd build
  • cmake ..
  • cmake --build .
  • tunggu process selesai dan anda bisa menggunakan file executablenya

Untuk Mac OS X

  • mkdir build
  • cd build
  • cmake ..
  • cmake --build .
  • tunggu process selesai dan anda bisa menggunakan file executablenya


  • #f03c15 NOTE : On progress to automate the installation.
  • #f03c15 NOTE : Mail to github project for more information.


FOLDER STRUCTURE

  • cmake (Cmake File to avoid boilerplate of cmake file)
  • include (folder header)
  • lib (Library of the header)
  • libparallel (Library that used for creating parallel execution. This is an abstraction of OpenCL FrameWork)
  • tools (tools program)
  • runtime-rt (Source program that used for testing)
  • unittests (program for to be compiled)

ROADMAP

Function

  • Function Declaration
  • Function Definition
  • Function Call
  • Function Variable Number Arguments

Data Type

  • Integer
  • Float
  • Boolean

Variable Table Declaration

  • Variable Declaration
  • Variable Lookup
  • Function Lookup
  • Variable names and constants
  • Procedure and function names
  • Literal Constant
  • Strings Literal
  • Compiler generated temporaries
  • Labels in source languages

Error Table

  • Simple table

Identifier

  • variable declaration and definition

Binary Expression

  • Simple Binary Expression
  • Support variable re-assign

Variable Type (signed and unsigned)

  • Support variable signed and unsigned

Operator

  • Support Multiply
  • Support Division
  • Support Addition
  • Support Substract
  • Support Modulo

Unary Operator

  • Support Unary Operator

Array

  • Simple pointer type
  • Simple Address of
  • Support nil value
  • Support Array Data Sequence
  • Support Vector Data Sequence

Dynamic Allocation

  • Support Malloc and Free

IO console (input/output)

  • Support simple output through c library
  • Support simple input
  • Support IO

Heterogeneous Computing

  • Implement Simple Internal Heterogeneous Computing (for prove of concept)

If / Else Statement

  • Support if decision
  • Support else if decision
  • Support else decision

For Statement

  • Support For-loop statement
  • Support For(while) statement
  • Support For(switch) statement

Struct

  • Support Struct

Function Struct

  • Support internal function inside struct

Function Struct by reference

  • Support Function by reference

Naming Mangling

  • By default use mangling name

BUGS

  • Weird Lexeme Location(row, col, position)
  • Special character need handled
  • I implemented binaryexpression for precedence associative right to left wrongly
  • Library inside lib folder instead of inside tools folder

BUGS SOLVED

  • weird lexeme Location solved by use filemapped source

About

Weasel language is a project i created to proof of concept that we can support heterogeneous internally inside a language.

Topics

Resources

License

Stars

Watchers

Forks

Languages