Skip to content

Instantly share code, notes, and snippets.

View thosakwe's full-sized avatar
🎯
Focusing

Tobe Osakwe thosakwe

🎯
Focusing
View GitHub Profile
@thosakwe
thosakwe / exists.
Created October 24, 2018 19:15
Proof-based language
property transitive {
let r(a) : Relation on a.
let x, y, z : in r.
assume (x, y) in r.
assume (y, z) in r.
declare (x, z) in r.
}
@thosakwe
thosakwe / github.declarative.txt
Last active September 11, 2018 00:55
Web Scraping ML???
// Simultaneously fetch three pages
fn main(url) {
// Asynchronously visit Github, and find all repos...
// Do this in the background.
//
// Returns a Task.
let myTask = fork {
let rq = fetch(url, {accept: 'text/html'})
let dom = response.dom()
let links = dom.querySelectorAll('a.repo-link')
@thosakwe
thosakwe / ascii.txt
Last active September 3, 2018 06:25
Hmmmrmrmr
val Ascii = (
A: 0x12,
// ...
z: 0x13
)
type Number = Uint8 | Uint16 // Etc.
fn (Number n) toString() : String {
var chars = Array(Uint16).new()
@thosakwe
thosakwe / distinct.spql
Last active August 12, 2018 20:00
SpartanDB
from users where {distinct username} select { username }
@thosakwe
thosakwe / Class.mnd
Last active July 20, 2018 07:02
MANDA
class Snake {
var name: String
get title: String {
return '%name the Legendary Snake'
}
set age (value: Num) {
}
@thosakwe
thosakwe / cat.csc
Created June 3, 2018 01:25
CASCADA
import file
def main |argc, argv|
if (>= (argc 2))
argv
| first
| file.read
| stdout
else
stdin | stdout
@thosakwe
thosakwe / README.md
Last active May 22, 2018 19:52
Dart build system?

DNB

This is a prototype of a CMake-based build tool for Dart native extensions. Combined with scripts, this would be comparable to node-gyp, but with actual Windows support, and no Python dependency.

DNB is designed to ensure portability across various platforms where Dart runs.

Examples explained

Note: In real projects, filenames would be dnb.yaml, dnb.macos.yaml, etc.

@thosakwe
thosakwe / foo.ts
Created May 5, 2018 02:47
*cries*
models {
// Define models (functions)
line(x: Num) -> Num
// Struct?
nlp(text: String, len: Num) -> (category: String, confidence: Num)
opts { cache }
}
train {
import 'package:dig/delegate.dart';
import 'package:path/path.dart' as p;
main(_, SendPort sendPort) {
return Dig.run(sendPort, (Dig dig) async {
var dig = await Dig.create(sendPort);
// Wait for these tasks to finish, or run them if they have not been completed.
await dig.depend(['string_scanner', 'source_span:some_task']);

What?

An ASM-inspired language that uses some familiar constructs to make building ASM easier.

It's basically ASM, but labels are given a function syntax. There also exists the concept of pointers, which are converted into address literals.

Declaring external functions is also supported, which makes it possible to verify the syntax of calls at compile time.

All in all, the compiler will be written in C++, and should in theory be quite fast, because in reality it is just a simple transpiler.