Skip to content

Instantly share code, notes, and snippets.

@bencz
bencz / gist:4115521
Created November 20, 2012 02:18
A HIPER basic compiler
/*
INPUT SAMPLE:
VAR TESTE = 25
PRINT "ALEXANDRE"
PRINT TESTE
GETCHAR
*/
@bencz
bencz / main.cpp
Created November 20, 2012 05:40
Basic compiler, generate IL CODE
/*
INPUT SAMPLE:
VAR NUMBER = 25
VAR STRING = "ALEX"
VAR ERRO = "THAT's NOT CAUSE AN ERROR :)"
PRINT ERRO
PRINT "ALEXANDRE"
PRINT NUMBER
@bencz
bencz / main.cs
Last active December 10, 2015 07:09
Extreme basic hiper basic master hiper mega basic test to include system
/*
Sample:
file: main.in
// Start with defines
@define basic = std'basic
@define type = sys'types
@bencz
bencz / main.cpp
Last active December 14, 2015 03:59
Hiper ultra mega tiny x86 JIT
#include <cstdio>
#include <vector>
#include <windows.h>
using namespace std;
class Buffer: public vector<unsigned char>
{
public:
void push_dword(DWORD dw)
@bencz
bencz / main.c
Last active December 14, 2015 08:38
metodo via assembly para negativar um numero...
#include <stdio.h>
int main(int argc, char **argv)
{
int numero = 0;
int retorno = 0;
printf("Entre com um numero: ");
scanf("%d", &numero);
#if defined(__GCC__)
@bencz
bencz / AST.h
Last active December 15, 2015 00:39
A test of compiler
using namespace System;
/* <stmt> := var <ident> = <expr>
| <ident> = <expr>
| for <ident> = <expr> to <expr> do <stmt> end
| read_int <ident>
| print <expr>
| <stmt> ; <stmt>
*/
public ref class Stmt abstract
@bencz
bencz / determinante.c
Created March 17, 2013 09:13
Programa para calcular o determinante de uma matriz NxN
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int m = 0;
double **a = 0;
int i = 0, j = 0, k = 0;
double factor = 0;
double temp = 0;
@bencz
bencz / gr.c
Created April 30, 2013 13:31
Program to calculate the Golden ratio with infinite decimal places of precision... :)
/*
1.61803398874989484820458683436563811772030917980576286213544862270526046281890
2449707207204189391137484754088075386891752126633862223536931793180060766726354
4333890865959395829056383226613199282902678806752087668925017116962070322210432
1626954862629631361443814975870122034080588795445474924618569536486444924104432
0771344947049565846788509874339442212544877066478091588460749988712400765217057
5179788341662562494075890697040002812104276217711177780531531714101170466659914
6697987317613560067087480710131795236894275219484353056783002287856997829778347
8458782289110976250030269615617002504643382437764861028383126833037242926752631
@bencz
bencz / gr.asm
Last active December 17, 2015 13:49
Calculate the gold number in Assembly :)
.extern _putchar
.extern _getchar
.globl _main
.data
bfs:
.zero 262144
.text
_main:
@bencz
bencz / main.fs
Created June 15, 2013 15:23
bf interpreter
open System
open System.IO
open System.Collections.Generic
let args = Environment.GetCommandLineArgs()
if args.Length <> 2 then Environment.Exit(1)
let bf = File.ReadAllText(args.[1])
let loop = Array.zeroCreate<int>(bf.Length)
let stack = Stack<int>()