Add propane and initial scene grammar

This commit is contained in:
Josh Holtrop 2023-11-17 19:22:18 -05:00
parent 6e04286cc2
commit 5ff83f6734
4 changed files with 78 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
/fart
*.bmp
*.png
/.propane*
/.rscons*
/build/

View File

@ -6,7 +6,16 @@ fart_env = env "fart" do |env|
env["DFLAGS"] += %w[-Werror -O2]
env["D_IMPORT_PATH"] += %w[src]
env["sources"] = glob("src/**/*.d")
env.Command("^/src/sceneparser.d", "src/sceneparser.propane",
"CMD" => %w[./propane ${_SOURCES} ${_TARGET}],
"CMD_DESC" => "Generating scene parser")
env.add_build_hook do |builder|
if builder.sources.first =~ /sceneparser\.d/
builder.vars["DFLAGS"] -= %w[-Werror]
end
end
env["sources"] = glob("src/**/*.d") + ["^/src/sceneparser.d"]
env.Program("fart", "${sources}")
end

45
propane Executable file

File diff suppressed because one or more lines are too long

22
src/sceneparser.propane Normal file
View File

@ -0,0 +1,22 @@
<<
import std.conv;
>>
token background;
token comma /,/;
token number /\d+(\.\d+)?/;
token lt /</;
token gt />/;
token semicolon /;/;
Start -> Statements;
Statements -> ;
Statements -> Statement Statements;
Statement -> BackgroundStatement;
BackgroundStatement -> background Vec3 semicolon;
Vec3 -> lt number comma number comma number gt;