Skip to content

Instantly share code, notes, and snippets.

@p4bl0-
p4bl0- / seven_segment_display.py
Created July 16, 2022 22:37
Actual example of PLY use
View seven_segment_display.py
### Pablo Rauzy
### Compsci bachelor / 1st semester / fundamental compsci
### Lab session 1 : Seven-Segment Display
import sys
import ply.lex as lex
import ply.yacc as yacc
import pygame
###
@p4bl0-
p4bl0- / 00_readme.md
Last active April 10, 2023 01:12
A complete compiler for a simple language (in less than 150 LoC)
View 00_readme.md

This project is a tiny compiler for a very simple language consisting of boolean expression.

The language has two constants: 1 for true and 0 for false, and 4 logic gates: ! (not), & (and), | (or), and ^ (xor).

It can also use parentheses to manage priorities.

Here is its grammar in BNF format:

expr ::= "0" | "1"

@p4bl0-
p4bl0- / echosrv.c
Last active February 9, 2017 00:17
Premier programme TCP : echo server simple.
View echosrv.c
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
int
@p4bl0-
p4bl0- / pingue.c
Created January 29, 2017 21:31
Version simplifiée de ping pour jouer avec les protocoles IP et ICMP, et avec la programmation réseau bas niveau (raw socket).
View pingue.c
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>