You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Pseudo](https://github.com/alehander42/pseudo) is a framework for high level code generation: it is used by this compiler to translate a subset of Python to all Pseudo-supported languages
16
9
17
10
## supported subset
18
11
19
-
`Pseudo` supports a very clear and somehow limited subset of a language:
12
+
Pseudo supports a very clear and somehow limited subset of a language:
20
13
21
14
* basic types and collections and standard library methods for them
* iteration (for-in-range / for-each / iterating over several collections / while)
43
37
* conditionals (if / else if / else)
44
38
* standard math/logical operations
45
39
46
-
## why
47
-
48
-
Supporting full-blown Python to Ruby auto translation is hard.
49
-
However often we need to
50
-
51
-
* translate/support some algorithms in different languages
52
-
* translate/support some text/data processing tool in different languages
53
-
* generate code for the same task/algorithm in different languages
54
-
55
-
Often that code is(or can be) expressed in very similar way, with
56
-
similar constructs and basic types and data structures. On that level
57
-
a lot of dynamic languages are very similar and the only real difference
58
-
is syntax and methods api. That's a feasible task for automatic translation
59
-
and actually the existance of `Pseudo` is to fullfill a need of another
60
-
existing project.
61
-
62
-
You can almost think of it in a "~json-for-algorithms" way: we express
63
-
our code with standard basic types, collections and simple classes and we can translate to a common format(pseudo code) and using it as a middle ground between each supported language
64
-
65
-
Error handling: support for hierarchies of custom exceptions, weak support for builtin exceptions, only catching and raising an Exception
66
-
67
40
## pseudo-python compiler
68
41
69
42
pseudo-python checks if your program is using a valid pseudo-translatable subset of Python, type checks it according to pseudo type rules and generates a `<filename>.pseudo.yaml` output file containing pseudo-ast code
70
43
44
+
[TODO]
71
45
you can directly run `pseudo-python <filename.py> <lang>` e.g.
0 commit comments