This file contains 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
#include <signal.h> /* raise, SIGTRAP (in fail, for debugging) */ | |
#include <stdio.h> /* fprintf, stderr (in _DBG, for debugging) */ | |
#include <unistd.h> /* write, read, _exit */ | |
#include <fcntl.h> /* open */ | |
#define _DBG(...) fprintf(stderr,__VA_ARGS__) | |
#define _DBGfn _DBG("%s:%d",__FILE__,__LINE__) | |
#define _TN ((char*[]){"EOF","NAM","INT"})[tok] | |
#define _pS(S) _DBG("%s\n",S) | |
#define _pD(S) _DBG("%d\n",S) | |
#define _pC(S) _DBG("'%c'\n",S) |
This file contains 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
/* Copyright © 2023 Anne Redko */ | |
/* Under the MIT License. https://mit-license.org/ */ | |
#include <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <ctype.h> | |
#include <stdint.h> | |
#include <stddef.h> |
This file contains 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
# by coinconclusive. in public domain. | |
from __future__ import annotations | |
from dataclasses import dataclass | |
from typing import ClassVar | |
@dataclass | |
class Lam: | |
name: str | |
body: Expr | |
def __str__(self): |
This file contains 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
// this compiles with -Wall -Wpedantic -Werror // | |
int s2i(char**s,int*n){ | |
int z=1;for(*n=0;**s>47 | |
;z*=10)*n=*n*10+*(*s)++ | |
-48;;return z;}void s2f | |
(char**s,float*f){int n | |
,z;s2i(s,&n);*f=n;+**s^ | |
46?0:(*f+=(++*s,z=s2i(s | |
,&n),(n+0.f)/z));}/*a*/ |