devosoft / pepper Goto Github PK
View Code? Open in Web Editor NEWPython Enhanced PreProcessor
License: MIT License
Python Enhanced PreProcessor
License: MIT License
Currently CFG's fail when a #if for example is written with whitespace before the pound.
subprocess.run
instead of subprocess.popen
How much do we care?
ex. this is valid
#if defined(M)
test;
#elif 1
std::cout << "test " << std::endl;
#endif
to prevent smelly code from leaking in, set up a flake8 pre-push hook
followup to #25, now we need to make function-like macros that can take arguments for their expansions (since these are the actually interesting macros).
This will require changes to the lexing and parsing structure, probably.
clang may be magical enough to allow us to integrate with it and pretend that we're a Real Compiler (tm)
This would probably matter more when we get to our milestone, but it would be good if we monitored performance so we don't accidentally triple our runtime at some point.
Should be fairly simple: either subprocess 'time' a bunch of runs, or use python's own time profiling monitors; run a few hundred rounds of the preprocessor, take the average and assert it's below a certian range.
We could make it CI-only so it doesn't clog the normal make test
call.
Currently there's a preprocess method on all the nodes that does nothing
Prereqs: Needs design of how to talk to a compiler
Will likely require a short code freeze, since it'll modify the top of a lot of files and break git change tracking
https://docs.pytest.org/en/3.0.0/xdist.html
useful if we keep adding subprocessed tests--these will always be slower than true unit tests.
Currently if we define an Macro with empty parentheticals, it crashes when we try to call it
i.e.
#define M() 1
int main()
{
#if M()
std::cout <<"call to with parentheses" << std::endl;
#endif
return 0;
}
returns pepper.symbol_table.PepperSyntaxError: Macro M expects args, but was given none.
but should be valid
For Pip, it looks like someone already snagged 'pepper':
https://pypi.python.org/pypi/pepper/0.2
We'll need a different package name to upload to pip.
@mercere99 @nahumj Opinions?
currently when we fatal error we use an exception, which will include a (useless) python stack trace. Instead, we should use a custom exception with an include trace or somesuch.
we have to re-scan expanded macro lines to detect if they contain additional macros, and expand them accordingly.
this should be (relatively) trivial after #17--we can now just take the output line and shove it back into the preprocessor if we expanded a macro in the last expansion.
Will add more complexity and side effects to the preprocessor module, should refactor later.
We keep running into problems where the test coverage is slightly below 100% generally due to impossibilities/weirdness in the coverage.
I've started ignoring the CI status, which is terrible, so I think I'm gonna lessen the coverage restriction to 95% or somesuch.
rply is a cleaner interface to generating our parse tree.
requires evaluating truthyness of arithmetic expressions
also we have to parse/evaluate arithmetic expressions
:P
why not to use SyntaxError
and the diff between pepper errors
Add subprocess'd tests to run the compiler against preprocessed code to make sure we're nailing all the things we need to nail to be an actual preprocessor
We have the power of python, we should be asserting against the objects and not the string representations of the objects
Detail: We can actually hand individual hunks of code to the parser to see what it does with them, and then assert against the object it hands back. This would be useful for testing individual lumps, and not just testing the output of the program.
there's a lot of shift/reduce warnings coming out of the parser, should fix thise
iostream uses this:
#pragma GCC system_header
diff-quality only checks the diff of the commits....against master, which is bad if you're committing directly to master.
make test
and TravisCI testrunnerpick your favorite CI system and set up automatic testing for pushes to all branches
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.