tomascartman / compiler Goto Github PK
View Code? Open in Web Editor NEWA compiler project to compile a language proposed by some teachers for the learning of the process of compilation
A compiler project to compile a language proposed by some teachers for the learning of the process of compilation
Some automatons can just ignore when the lexeme do not fit on them, but others they (probably) must declare an error, for now i have notice that AutomatonNumbers and AutomatonLogicalOperators should put an error.
AutomatonNumbers when it finish the lexeme with a 'dot', without a number at the end, or when it starts with a 'dot'.
AutomatonLogicalOperators when it get only one '&' or '|' symbol.
I don't know if this error should be task of the Lexer, whom has the next char or somehow the automatons should be responsible for this job. Maybe the lexer reporting an error after 'n' lookaheadChar gets trying the new lexeme will handle this problem
In the diagram, after the state zero, all the other states are already valid states without a second char, excpet state two, which is represented by "!", it needs to be followed by a "=" like "!=" to be a valid token. it must be decided if the lexer.kt will reset the automaton or the automaton itself will do this job, and so implements and use the operator lookahead to test if after a "invalid" char "!" we can get a valid token "!=" by looking the following char.
When the input file is read, the caracters that should be of escape like '"' or '\n' are put on the list of strings (sourceCode) like '' and '"', this is a problem to some automatons, in specific the AutomatonString that handles the char '"'.
Because it's already in the list of strings, it will be read once char at time, and treated like that, needing a special tratament at the automatons that should handle those escape chars.
It's a simple if before sending a char to the automatons to test if this char is an space.
Create tests to verify if the code is doing what it should be doing without a human (and human mistakes).
There is no problem when two operator are in sequence, like "==" or ">=", but the linguage do not allows three operator in sequence, like "===", this should be a error, in the current code this would be treat like "==" first and then "=", generating two tokens.
After reading the file, trying to use the function nextChar() to access the list one char at time, blank lines in the file causes a java.lang.StringIndexOutOfBoundsException
The automatons should have a function to return a token when asked if it is in a valid state to generate the token. This will remove a lot of "if" code from the lexer, which should not be doing these tests.
A Token class should be created.
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.