#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define MAX 50
typedef enum {
ATOM,LIST}ElemTag;
typedef char AtomType;
typedef struct lnode{
ElemTag flag; //ATOM==0原子; LIST==1 子表
union{
//原子结点和表结点的联合部分
AtomType atom;
struct lnode * hp;
}val;
struct lnode * tp;
}*Gl, Lnode;
void InitGlnode(Gl *gl, char *ch); //创建广义表(扩展线性链表的存储结构)
bool sever(char *head, char *tail); //分离函数
int Gllen(Gl gl); //长度
int Depth(Gl gl); //深度
void show(Gl gl); //打印
void pshow(Gl gl);
int main(void)
{
Gl gl = NULL;
char ch1[MAX] = "((a,b),(c,d))";
char ch2[MAX] = "((a),(b),((c)),((1,2,(r,(g,h,e),h))),(h))";
char ch3[MAX] = "((),(),())";
char ch4[MAX] = "(a,((b,c),d))";
char ch5[MAX] = "((),(e),(a,(b,c,d)))";
InitGlnode(&gl, ch2);
show(gl);
// pshow(gl);
printf("\n");
printf
11-07
5815

11-15
2418

03-24
1559
