let-unimi / liblet Goto Github PK
View Code? Open in Web Editor NEWA teaching aid library for formal languages and compiler courses
Home Page: https://liblet.readthedocs.io/
License: Creative Commons Attribution Share Alike 4.0 International
A teaching aid library for formal languages and compiler courses
Home Page: https://liblet.readthedocs.io/
License: Creative Commons Attribution Share Alike 4.0 International
In the file automaton_test.py there is a test (test_transition_lt
) that's a bit strange, feels like there's been a copy-paste from the one above
Shouldn't it be something like
def test_transition_lt(self):
self.assetTrue(t1.__lt__(t2))
where t1
and t2
are previously defined transitions?
Regards,
Manuele
Evaluate if it will be convenient to add the said method.
Nell' handout 5 nella cella 6 viene invocato all_terminals ma esce questo errore. Ho provato a invocarlo pure nel playground ma non va lo stesso.
It could be reasonable to allow for the prod
argument of Grammar.step
and Grammar.{left, right}most
to be not only a production index, but also a Production
. This will avoid the need for G.P.index(prod)
in calling code.
Such class can provide several functionalities now spread out in the library (using dicts, or dods):
try
or if
),dict2table
and dod2table
).Such class could simplify the LL/LR lectures quite a bit.
In order to simplify the presentation of algorithms exploring the computation graph of (N)PDAs it could be convenient to have an immutable version of such data structures.
If you restrict a grammar using the restrict_to
method and you don't pass the start symbol within the symbols to keep, what happens to the grammar? Should the method throw some sort of error/exception? Should it try to retrieve the first (single) lhs of another kept production rule in order to get a new start symbol, if possible?
If you define an object of the AnnotatedTreeWalker
class that makes use of attributes within the registered functions, saving the ATW object with the save
method does not save the attributes used, as in the case of the following example:
from liblet import AnnotatedTreeWalker, Tree
tree = Tree({'name': 'test'})
test_atw = AnnotatedTreeWalker('name')
@test_atw.register
def test(visit, ast):
test_atw.VAR = 5
print(test_atw.VAR)
print(3)
test_atw(tree) # out: 5 3
test_atw.save('test.atw')
test_atw = AnnotatedTreeWalker.load('test.atw')
test_atw(tree) # out: exception
By running the above code, an error is raised:
NameError: name 'test_atw' is not defined
The Stack
data structure should iterate from the top (via sequence of pop
), currently it iterates in the reverse order:
list(Stack([1,2,3]))
should produce [3, 2, 1]
but now produces [1, 2, 3]
.
This will break compatibility quite badly. At least the https://github.com/let-unimi/handouts should be revised in accordance to the change.
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.