roccojiang / traversal-lang Goto Github PK
View Code? Open in Web Editor NEWTraversal programming language, designed to bridge the gap between block-based and text-based languages
Traversal programming language, designed to bridge the gap between block-based and text-based languages
Due to the parsing grammar of Traversal, certain whitespace characters (sometimes spaces, especially tabs) cause errors when placed at the end of lines. This causes a lot of confusion as the error messages aren't very indicative of the actual error.
If there is one (and only one) newline at the end of test.txt, no errors are thrown. However, if there is a newline anywhere else or more than one at the end of the file, the ValueError: Ran into a $end token where it wasn't expected
error is thrown.
Error reports should also specify the error type, not just the error message. Perhaps use the logging
library?
Currently the parser takes input from test.txt
line-by-line, as written in main.py
, because the parser currently cannot take in multi-line input and can only deal with one line. This 'hacky' approach will have to be eventually rewritten to support more complex code.
A weird effect of this implementation is that a newline must be present at the end of test.txt
, as every line has to be terminated with a \n
character.
Due to how a NEWLINE token is used to end a line of input, the parser does not ignore \n
characters. This means that any extra newlines will raise an error.
Comment tokens have been replaced by using regex to ignore all text following //, thus all old code referring to COMMENT tokens should be removed
As of commit 14689be, comparison operators are completely handled by the Python interpreter. Custom rules should be added to enforce:
As of commit 4239769, certain comparison operator rules may cause some confusing grammar. These rules should be considered and potentially modified in the future.
Due to booleans no longer being treated as integers:
1 = 1 = 1
evaluates to false
as this becomes true = 1
<=
, <
, >=
, or >
which makes senseDue to strings being unable to be compared using <=
, <
, >=
, or >
:
"hello" <= "hello"
throws an error even though technically it could be seen as true
?Just in general
Because the parser can only parse one line of text, main.py
takes text line-by-line from test.txt
to 'feed' into the parser. This isn't necessarily an issue but I'll leave this here as a reminder in case I want to come back to this in the future.
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.