This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass | |
from typing import Literal | |
type LeftParen = Literal["("] | |
type RightParen = Literal[")"] | |
type Number = int | |
type Token = LeftParen | RightParen | NumberLiteral | Identifier | Def | Eof | If | StringLiteral | LogicLiteral | |
@dataclass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lucas Wolschick (C) 2022 | |
// You should probably not use this as this has not been tested | |
// Usage: brainfuck [file] | |
// | |
// Try it with this code (available at en.wikipedia.org/wiki/Brainfuck, not mine!) | |
// ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::Write; | |
#[derive(Debug, Copy, Clone, Eq, PartialEq)] | |
enum Tile { | |
X, | |
O, | |
Empty, | |
} | |
impl Tile { |