A Nix language parser implemented in C (ragel + bison)
at main 29 lines 838 B view raw
1nothing: 2 3ragel: 4 ragel -C -G2 -o parser/machine.c parser/machine.rl 5 6bison: 7 bison -d -o parser/parser.c parser/parser.y 8 9build: ragel bison 10 gcc -std=c11 -O2 -I parser -o bin/lexdemo \ 11 parser/main.c parser/machine.c parser/parser.c parser/nodetype.c parser/lexer_helper.c parser/lexer_adapter.c 12 gcc -std=c11 -O2 -I parser -o bin/walk \ 13 parser/walk.c parser/machine.c parser/parser.c parser/nodetype.c parser/lexer_helper.c parser/lexer_adapter.c 14 15run: build 16 ./bin/lexdemo nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix 17 18run-walk: build 19 ./bin/walk ./nixpkgs/lib 20 21test: build gen-c-ast 22 @echo "Done" 23 24test_nix := "nixpkgs/pkgs/development/haskell-modules/hackage-packages.nix" 25# test_nix := "nixpkgs/pkgs/top-level/all-packages.nix" 26# test_nix := "test.nix" 27 28gen-c-ast: build 29 ./bin/lexdemo {{test_nix}} > tmp/c.ast