Start exploring the parser
This commit is contained in:
parent
0a7e2f7f0c
commit
6d08b38058
4
compile
4
compile
@ -17,4 +17,8 @@ SRC+=" src/json_entities/*.c"
|
|||||||
CFLAGS+=" -Iinclude/lexer"
|
CFLAGS+=" -Iinclude/lexer"
|
||||||
SRC+=" src/lexer/*.c"
|
SRC+=" src/lexer/*.c"
|
||||||
|
|
||||||
|
# PARSER
|
||||||
|
CFLAGS+=" -Iinclude/parser"
|
||||||
|
SRC+=" src/parser/*.c"
|
||||||
|
|
||||||
$CC $CFLAGS $SRC -o $OUT
|
$CC $CFLAGS $SRC -o $OUT
|
||||||
|
@ -11,13 +11,14 @@
|
|||||||
"-Iinclude/dstring",
|
"-Iinclude/dstring",
|
||||||
"-Iinclude/json_entities",
|
"-Iinclude/json_entities",
|
||||||
"-Iinclude/lexer",
|
"-Iinclude/lexer",
|
||||||
|
"-Iinclude/parser",
|
||||||
"-o",
|
"-o",
|
||||||
"main",
|
"main",
|
||||||
"src/main.c"
|
"src/main.c"
|
||||||
],
|
],
|
||||||
"directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json",
|
"directory": "/Users/abdelrahman/dev/personal/say-it-in-json",
|
||||||
"file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/main.c",
|
"file": "/Users/abdelrahman/dev/personal/say-it-in-json/src/main.c",
|
||||||
"output": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/main"
|
"output": "/Users/abdelrahman/dev/personal/say-it-in-json/main"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
@ -31,13 +32,14 @@
|
|||||||
"-Iinclude/dstring",
|
"-Iinclude/dstring",
|
||||||
"-Iinclude/json_entities",
|
"-Iinclude/json_entities",
|
||||||
"-Iinclude/lexer",
|
"-Iinclude/lexer",
|
||||||
|
"-Iinclude/parser",
|
||||||
"-o",
|
"-o",
|
||||||
"main",
|
"main",
|
||||||
"src/dstring/dstring.c"
|
"src/dstring/dstring.c"
|
||||||
],
|
],
|
||||||
"directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json",
|
"directory": "/Users/abdelrahman/dev/personal/say-it-in-json",
|
||||||
"file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/dstring/dstring.c",
|
"file": "/Users/abdelrahman/dev/personal/say-it-in-json/src/dstring/dstring.c",
|
||||||
"output": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/main"
|
"output": "/Users/abdelrahman/dev/personal/say-it-in-json/main"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
@ -51,13 +53,14 @@
|
|||||||
"-Iinclude/dstring",
|
"-Iinclude/dstring",
|
||||||
"-Iinclude/json_entities",
|
"-Iinclude/json_entities",
|
||||||
"-Iinclude/lexer",
|
"-Iinclude/lexer",
|
||||||
|
"-Iinclude/parser",
|
||||||
"-o",
|
"-o",
|
||||||
"main",
|
"main",
|
||||||
"src/json_entities/json_entities.c"
|
"src/json_entities/json_entities.c"
|
||||||
],
|
],
|
||||||
"directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json",
|
"directory": "/Users/abdelrahman/dev/personal/say-it-in-json",
|
||||||
"file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/json_entities/json_entities.c",
|
"file": "/Users/abdelrahman/dev/personal/say-it-in-json/src/json_entities/json_entities.c",
|
||||||
"output": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/main"
|
"output": "/Users/abdelrahman/dev/personal/say-it-in-json/main"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
@ -71,296 +74,34 @@
|
|||||||
"-Iinclude/dstring",
|
"-Iinclude/dstring",
|
||||||
"-Iinclude/json_entities",
|
"-Iinclude/json_entities",
|
||||||
"-Iinclude/lexer",
|
"-Iinclude/lexer",
|
||||||
|
"-Iinclude/parser",
|
||||||
"-o",
|
"-o",
|
||||||
"main",
|
"main",
|
||||||
"src/lexer/lexer.c"
|
"src/lexer/lexer.c"
|
||||||
],
|
],
|
||||||
"directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json",
|
"directory": "/Users/abdelrahman/dev/personal/say-it-in-json",
|
||||||
"file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/lexer/lexer.c",
|
"file": "/Users/abdelrahman/dev/personal/say-it-in-json/src/lexer/lexer.c",
|
||||||
"output": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/main"
|
"output": "/Users/abdelrahman/dev/personal/say-it-in-json/main"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"arguments": [
|
"arguments": [
|
||||||
"/usr/bin/clang-16",
|
"/usr/bin/clang",
|
||||||
"-cc1",
|
"-c",
|
||||||
"-triple",
|
"-g",
|
||||||
"x86_64-redhat-linux-gnu",
|
|
||||||
"-emit-obj",
|
|
||||||
"-mrelax-all",
|
|
||||||
"-disable-free",
|
|
||||||
"-clear-ast-before-backend",
|
|
||||||
"-disable-llvm-verifier",
|
|
||||||
"-discard-value-names",
|
|
||||||
"-main-file-name",
|
|
||||||
"-mrelocation-model",
|
|
||||||
"static",
|
|
||||||
"-mframe-pointer=all",
|
|
||||||
"-fmath-errno",
|
|
||||||
"-ffp-contract=on",
|
|
||||||
"-fno-rounding-math",
|
|
||||||
"-mconstructor-aliases",
|
|
||||||
"-funwind-tables=2",
|
|
||||||
"-target-cpu",
|
|
||||||
"x86-64",
|
|
||||||
"-tune-cpu",
|
|
||||||
"generic",
|
|
||||||
"-mllvm",
|
|
||||||
"-treat-scalable-fixed-error-as-warning",
|
|
||||||
"-debug-info-kind=constructor",
|
|
||||||
"-dwarf-version=4",
|
|
||||||
"-debugger-tuning=gdb",
|
|
||||||
"-fcoverage-compilation-dir=/home/abdelrahman/dev_work/say_it_in_json",
|
|
||||||
"-resource-dir",
|
|
||||||
"/usr/lib64/clang/16",
|
|
||||||
"-I",
|
|
||||||
"include",
|
|
||||||
"-I",
|
|
||||||
"include/dstring",
|
|
||||||
"-I",
|
|
||||||
"include/json_entities",
|
|
||||||
"-I",
|
|
||||||
"include/lexer",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/lib64/clang/16/include",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/local/include",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include",
|
|
||||||
"-internal-externc-isystem",
|
|
||||||
"/include",
|
|
||||||
"-internal-externc-isystem",
|
|
||||||
"/usr/include",
|
|
||||||
"-Wall",
|
"-Wall",
|
||||||
"-Werror",
|
"-Werror",
|
||||||
"-pedantic",
|
"-pedantic",
|
||||||
"-fdebug-compilation-dir=/home/abdelrahman/dev_work/say_it_in_json",
|
"-Iinclude",
|
||||||
"-ferror-limit",
|
"-Iinclude/dstring",
|
||||||
"19",
|
"-Iinclude/json_entities",
|
||||||
"-fgnuc-version=4.2.1",
|
"-Iinclude/lexer",
|
||||||
"-fcolor-diagnostics",
|
"-Iinclude/parser",
|
||||||
"-faddrsig",
|
|
||||||
"-D__GCC_HAVE_DWARF2_CFI_ASM=1",
|
|
||||||
"-x",
|
|
||||||
"c",
|
|
||||||
"-o",
|
"-o",
|
||||||
"/tmp/main-a21b7e.o",
|
"main",
|
||||||
"src/main.c"
|
"src/parser/parser.c"
|
||||||
],
|
],
|
||||||
"directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json",
|
"directory": "/Users/abdelrahman/dev/personal/say-it-in-json",
|
||||||
"file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/main.c",
|
"file": "/Users/abdelrahman/dev/personal/say-it-in-json/src/parser/parser.c",
|
||||||
"output": "/tmp/main-a21b7e.o"
|
"output": "/Users/abdelrahman/dev/personal/say-it-in-json/main"
|
||||||
},
|
|
||||||
{
|
|
||||||
"arguments": [
|
|
||||||
"/usr/bin/clang-16",
|
|
||||||
"-cc1",
|
|
||||||
"-triple",
|
|
||||||
"x86_64-redhat-linux-gnu",
|
|
||||||
"-emit-obj",
|
|
||||||
"-mrelax-all",
|
|
||||||
"-disable-free",
|
|
||||||
"-clear-ast-before-backend",
|
|
||||||
"-disable-llvm-verifier",
|
|
||||||
"-discard-value-names",
|
|
||||||
"-main-file-name",
|
|
||||||
"-mrelocation-model",
|
|
||||||
"static",
|
|
||||||
"-mframe-pointer=all",
|
|
||||||
"-fmath-errno",
|
|
||||||
"-ffp-contract=on",
|
|
||||||
"-fno-rounding-math",
|
|
||||||
"-mconstructor-aliases",
|
|
||||||
"-funwind-tables=2",
|
|
||||||
"-target-cpu",
|
|
||||||
"x86-64",
|
|
||||||
"-tune-cpu",
|
|
||||||
"generic",
|
|
||||||
"-mllvm",
|
|
||||||
"-treat-scalable-fixed-error-as-warning",
|
|
||||||
"-debug-info-kind=constructor",
|
|
||||||
"-dwarf-version=4",
|
|
||||||
"-debugger-tuning=gdb",
|
|
||||||
"-fcoverage-compilation-dir=/home/abdelrahman/dev_work/say_it_in_json",
|
|
||||||
"-resource-dir",
|
|
||||||
"/usr/lib64/clang/16",
|
|
||||||
"-I",
|
|
||||||
"include",
|
|
||||||
"-I",
|
|
||||||
"include/dstring",
|
|
||||||
"-I",
|
|
||||||
"include/json_entities",
|
|
||||||
"-I",
|
|
||||||
"include/lexer",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/lib64/clang/16/include",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/local/include",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include",
|
|
||||||
"-internal-externc-isystem",
|
|
||||||
"/include",
|
|
||||||
"-internal-externc-isystem",
|
|
||||||
"/usr/include",
|
|
||||||
"-Wall",
|
|
||||||
"-Werror",
|
|
||||||
"-pedantic",
|
|
||||||
"-fdebug-compilation-dir=/home/abdelrahman/dev_work/say_it_in_json",
|
|
||||||
"-ferror-limit",
|
|
||||||
"19",
|
|
||||||
"-fgnuc-version=4.2.1",
|
|
||||||
"-fcolor-diagnostics",
|
|
||||||
"-faddrsig",
|
|
||||||
"-D__GCC_HAVE_DWARF2_CFI_ASM=1",
|
|
||||||
"-x",
|
|
||||||
"c",
|
|
||||||
"-o",
|
|
||||||
"/tmp/dstring-17d81f.o",
|
|
||||||
"src/dstring/dstring.c"
|
|
||||||
],
|
|
||||||
"directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json",
|
|
||||||
"file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/dstring/dstring.c",
|
|
||||||
"output": "/tmp/dstring-17d81f.o"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"arguments": [
|
|
||||||
"/usr/bin/clang-16",
|
|
||||||
"-cc1",
|
|
||||||
"-triple",
|
|
||||||
"x86_64-redhat-linux-gnu",
|
|
||||||
"-emit-obj",
|
|
||||||
"-mrelax-all",
|
|
||||||
"-disable-free",
|
|
||||||
"-clear-ast-before-backend",
|
|
||||||
"-disable-llvm-verifier",
|
|
||||||
"-discard-value-names",
|
|
||||||
"-main-file-name",
|
|
||||||
"-mrelocation-model",
|
|
||||||
"static",
|
|
||||||
"-mframe-pointer=all",
|
|
||||||
"-fmath-errno",
|
|
||||||
"-ffp-contract=on",
|
|
||||||
"-fno-rounding-math",
|
|
||||||
"-mconstructor-aliases",
|
|
||||||
"-funwind-tables=2",
|
|
||||||
"-target-cpu",
|
|
||||||
"x86-64",
|
|
||||||
"-tune-cpu",
|
|
||||||
"generic",
|
|
||||||
"-mllvm",
|
|
||||||
"-treat-scalable-fixed-error-as-warning",
|
|
||||||
"-debug-info-kind=constructor",
|
|
||||||
"-dwarf-version=4",
|
|
||||||
"-debugger-tuning=gdb",
|
|
||||||
"-fcoverage-compilation-dir=/home/abdelrahman/dev_work/say_it_in_json",
|
|
||||||
"-resource-dir",
|
|
||||||
"/usr/lib64/clang/16",
|
|
||||||
"-I",
|
|
||||||
"include",
|
|
||||||
"-I",
|
|
||||||
"include/dstring",
|
|
||||||
"-I",
|
|
||||||
"include/json_entities",
|
|
||||||
"-I",
|
|
||||||
"include/lexer",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/lib64/clang/16/include",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/local/include",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include",
|
|
||||||
"-internal-externc-isystem",
|
|
||||||
"/include",
|
|
||||||
"-internal-externc-isystem",
|
|
||||||
"/usr/include",
|
|
||||||
"-Wall",
|
|
||||||
"-Werror",
|
|
||||||
"-pedantic",
|
|
||||||
"-fdebug-compilation-dir=/home/abdelrahman/dev_work/say_it_in_json",
|
|
||||||
"-ferror-limit",
|
|
||||||
"19",
|
|
||||||
"-fgnuc-version=4.2.1",
|
|
||||||
"-fcolor-diagnostics",
|
|
||||||
"-faddrsig",
|
|
||||||
"-D__GCC_HAVE_DWARF2_CFI_ASM=1",
|
|
||||||
"-x",
|
|
||||||
"c",
|
|
||||||
"-o",
|
|
||||||
"/tmp/json_entities-66f73b.o",
|
|
||||||
"src/json_entities/json_entities.c"
|
|
||||||
],
|
|
||||||
"directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json",
|
|
||||||
"file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/json_entities/json_entities.c",
|
|
||||||
"output": "/tmp/json_entities-66f73b.o"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"arguments": [
|
|
||||||
"/usr/bin/clang-16",
|
|
||||||
"-cc1",
|
|
||||||
"-triple",
|
|
||||||
"x86_64-redhat-linux-gnu",
|
|
||||||
"-emit-obj",
|
|
||||||
"-mrelax-all",
|
|
||||||
"-disable-free",
|
|
||||||
"-clear-ast-before-backend",
|
|
||||||
"-disable-llvm-verifier",
|
|
||||||
"-discard-value-names",
|
|
||||||
"-main-file-name",
|
|
||||||
"-mrelocation-model",
|
|
||||||
"static",
|
|
||||||
"-mframe-pointer=all",
|
|
||||||
"-fmath-errno",
|
|
||||||
"-ffp-contract=on",
|
|
||||||
"-fno-rounding-math",
|
|
||||||
"-mconstructor-aliases",
|
|
||||||
"-funwind-tables=2",
|
|
||||||
"-target-cpu",
|
|
||||||
"x86-64",
|
|
||||||
"-tune-cpu",
|
|
||||||
"generic",
|
|
||||||
"-mllvm",
|
|
||||||
"-treat-scalable-fixed-error-as-warning",
|
|
||||||
"-debug-info-kind=constructor",
|
|
||||||
"-dwarf-version=4",
|
|
||||||
"-debugger-tuning=gdb",
|
|
||||||
"-fcoverage-compilation-dir=/home/abdelrahman/dev_work/say_it_in_json",
|
|
||||||
"-resource-dir",
|
|
||||||
"/usr/lib64/clang/16",
|
|
||||||
"-I",
|
|
||||||
"include",
|
|
||||||
"-I",
|
|
||||||
"include/dstring",
|
|
||||||
"-I",
|
|
||||||
"include/json_entities",
|
|
||||||
"-I",
|
|
||||||
"include/lexer",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/lib64/clang/16/include",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/local/include",
|
|
||||||
"-internal-isystem",
|
|
||||||
"/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include",
|
|
||||||
"-internal-externc-isystem",
|
|
||||||
"/include",
|
|
||||||
"-internal-externc-isystem",
|
|
||||||
"/usr/include",
|
|
||||||
"-Wall",
|
|
||||||
"-Werror",
|
|
||||||
"-pedantic",
|
|
||||||
"-fdebug-compilation-dir=/home/abdelrahman/dev_work/say_it_in_json",
|
|
||||||
"-ferror-limit",
|
|
||||||
"19",
|
|
||||||
"-fgnuc-version=4.2.1",
|
|
||||||
"-fcolor-diagnostics",
|
|
||||||
"-faddrsig",
|
|
||||||
"-D__GCC_HAVE_DWARF2_CFI_ASM=1",
|
|
||||||
"-x",
|
|
||||||
"c",
|
|
||||||
"-o",
|
|
||||||
"/tmp/lexer-66d0ff.o",
|
|
||||||
"src/lexer/lexer.c"
|
|
||||||
],
|
|
||||||
"directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json",
|
|
||||||
"file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/lexer/lexer.c",
|
|
||||||
"output": "/tmp/lexer-66d0ff.o"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
8
include/parser/parser.h
Normal file
8
include/parser/parser.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef PARSER_H
|
||||||
|
#define PARSER_H
|
||||||
|
|
||||||
|
#include "lexer.h"
|
||||||
|
|
||||||
|
void parse_token(token_t token);
|
||||||
|
|
||||||
|
#endif // !PARSER_H
|
6
src/parser/parser.c
Normal file
6
src/parser/parser.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "parser.h"
|
||||||
|
#include "json_entities.h"
|
||||||
|
#include "lexer.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void parse_token(token_t token) {}
|
Loading…
Reference in New Issue
Block a user