Skip to content

Instantly share code, notes, and snippets.

@Islidius
Islidius / firstandfollowsets.js
Created August 21, 2019 11:40
Small piece of code to generate FIRST and FOLLOW sets
// 'ε' symbol for empty symbol
const EPSILON = 'ε';
// this is a set that tracks the fact it contains 'ε' seperatly
class CustomSet {
constructor() {
this.set = new Set();
this.eps = false;
}
return:
settingup:
LOADI 0
STORE 500 #accu
LOADI 0
STORE 501 #flags
LOADI -1
STORE 502#stack pos
LOADI 0
STORE 503#pc