We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b2ed859 commit e3acea9Copy full SHA for e3acea9
Makefile
@@ -5,11 +5,13 @@ BISON = bison
5
CPP = g++
6
CPPFLAGS = -std=c++20 -O3
7
TARGET = psc
8
+PROGS = pscexamples
9
10
AUTOGEN = Parser.hpp Parser.cpp Lexer.cpp Location.hpp
11
OBJS = Lexer.o Parser.o main.o
12
+PROGS_OBJS = pscexamples.o
13
-all: $(TARGET)
14
+all: $(TARGET)$(PROGS)
15
16
$(AUTOGEN): scanner.l grammar.y
17
$(BISON) grammar.y
@@ -21,8 +23,11 @@ $(AUTOGEN): scanner.l grammar.y
21
23
$(TARGET): $(AUTOGEN) $(OBJS)
22
24
$(CPP) $(CPPFLAGS) -o $(TARGET) $(OBJS)
25
26
+$(PROGS): $(PROGS_OBJS)
27
+ $(CPP) $(CPPFLAGS) -o $(PROGS) $(PROGS_OBJS)
28
+
29
clean:
- rm -f $(TARGET) $(AUTOGEN) $(OBJS)
30
+ rm -f $(PROGS)$(PROGS_OBJS)$(TARGET) $(AUTOGEN) $(OBJS)
31
32
# Static dependencies
33
Lexer.o: SymbolTypes.hpp Tree.hpp Expression.hpp Symbol.hpp Lexer.hpp Parser.hpp
Makefile.nmake
@@ -13,8 +13,10 @@ CPPFlags = /nologo /EHsc /std:c++20 /O2 /wd4005 $(FlexLexer_h)
Target = psc.exe
Objs = Lexer.obj Parser.obj main.obj
Autogen = Lexer.cpp Parser.hpp Parser.cpp Location.hpp
+Progs = pscexamples.exe
+ProgsObjs = pscexamples.obj
18
-all: $(Target)
19
+all: $(Target) $(Progs)
20
$(Autogen): scanner.l grammar.y
$(Bison) grammar.y
@@ -26,8 +28,11 @@ $(Autogen): scanner.l grammar.y
$(Target): $(Autogen) $(Objs)
$(CPP) $(CPPFlags) /Fe$(Target) $(Objs)
+$(Progs): $(ProgsObjs)
+ $(CPP) $(CPPFlags) /Fe$(Progs) $(ProgsObjs)
34
- del $(Target) $(Objs) $(Autogen)
35
+ del $(Progs) $(ProgsObjs) $(Target) $(Objs) $(Autogen)
36
37
38
Lexer.obj: SymbolTypes.hpp Tree.hpp Expression.hpp Symbol.hpp Lexer.hpp Parser.hpp
pscexamples.cpp
@@ -0,0 +1,27 @@
1
+// pscexamples.cpp : group pseudocode programs into .js file for web interface
2
+// Note: use ./pscexamples hello.psc chars.psc ... > ../pscexamples.js
3
4
+#include <iostream>
+#include <fstream>
+#include <span>
+#include <string>
+using std::span;
+using std::cout;
+using std::ifstream;
+using std::string;
+int main(const int argc, const char **argv) {
+ span<const char*> args{ argv + 1, argv + argc };
+ cout << "pseudocode_examples = [ ";
+ for (auto sep = ""; auto pscfile : args) {
+ cout << sep << "{ name: \'" << pscfile << "\', code: `";
+ ifstream file(pscfile);
+ string code;
+ getline(file, code, '0円');
+ cout << code;
+ cout << "` }";
+ sep = ", ";
+ }
+ cout << " ];";
+}
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments