Skip to content

Instantly share code, notes, and snippets.

View jeffersonmourak's full-sized avatar
:shipit:

Jefferson Oliveira jeffersonmourak

:shipit:
View GitHub Profile
import Foundation
enum ParserError: Error {
case UnknownToken(String)
case BadToken(String)
case Ouch(String)
case IdentifierNotDefined(String)
case UnexpectedToken(String)
}
//
// tokens.swift
// compilers
//
// Created by Jefferson Oliveira on 5/8/25.
//
struct TokenContext {
var input: [Character]
@jeffersonmourak
jeffersonmourak / infixToPostfix.ts
Created May 7, 2025 17:13
Parser from infix notation to postfix notation.
type Ops = "*" | "+" | "-" | "/";
type Postfix = (number | Ops)[];
// const infix = "(2 + 8 / 2 * (1 + 2) - 2)";
const infix = "(12 + 8 / 2 * (1 + 2) - 14)";
const precedence: Record<string, number> = {
"+": 1,
"-": 1,
"*": 2,

Keybase proof

I hereby claim:

  • I am jeffersonmourak on github.
  • I am jeffersonmourak (https://keybase.io/jeffersonmourak) on keybase.
  • I have a public key ASD8oMIMOk_eg1chMbwMnuBzTZpr81Nu_NWya3sppJy9MQo

To claim this, I am signing this object:

@jeffersonmourak
jeffersonmourak / Canvas.js
Created July 3, 2021 21:54
Space Inverders Game
/**
* Game Engine
*/
class Canvas {
/**
* Stores the DOM elements that will be used on this code.
*/
#elements = {};
/**
[
{
"symbol": "AACG",
"securityName": "ATA Creativity Global - American Depositary Shares"
},
{
"symbol": "AACQ",
"securityName": "Artius Acquisition Inc. - Class A Common Stock"
},
{
class Debounce {
constructor(fn, wait, accumulator) {
this.fn = fn;
this.wait = wait || 500;
this.accumulator = accumulator;
this.store = '';
this.timeout;
}
call() {
/**
* Dubiously created by Adrian Cooney
* http://adriancooney.github.io
*/
(function(console) {
"use strict";
//Bootlegged of imgur.com/memegen
var memes = {"10 Guy":"//i.imgur.com/LaENqOV.jpg","3rd World Success Kid":"//i.imgur.com/WA5duA1.jpg","90's Problems":"//i.imgur.com/tL47qtp.jpg","Aaand It's Gone":"//i.imgur.com/yf12saq.jpg","Actual Advice Mallard":"//i.imgur.com/WymFmVy.jpg","Advice Dog":"//i.imgur.com/Qk0VO6D.jpg","Advice God":"//i.imgur.com/xH2fSFg.jpg","Almost Politically Correct Redneck":"//i.imgur.com/YqLgINf.jpg","Am I The Only One":"//i.imgur.com/gS9YL5U.jpg","Ancient Aliens":"//i.imgur.com/NfCknz0.jpg","Annoyed Picard":"//i.imgur.com/s9GmfSS.jpg","Annoying Childhood Friend":"//i.imgur.com/27VCyQw.jpg","Annoying Facebook Girl":"//i.imgur.com/ccczyGt.jpg","Anti-Joke Chicken (Rooster)":"//i.imgur.com/KOsW0jh.jpg","Awkward Penguin":"//i.imgur.com/ez1tQrq.jpg","Back In My Day Grandpa":"//i.imgur.com/zuJSZp8.jpg","Bad Advice Mallard":"//i.imgur.com/QEPvL2B.jpg","Bad Luck Brian":"//i.imgur.
navigator.getBattery().then(battery=>{
function updateAllBatteryInfo() {
updateChargeInfo();
updateLevelInfo();
updateChargingInfo();
updateDischargingInfo();
}
updateAllBatteryInfo();
battery.addEventListener('chargingchange', function() {