Skip to content

Commit 5be48ee

Browse files
committed
Change README
1 parent 49bcf44 commit 5be48ee

File tree

2 files changed

+16
-44
lines changed

2 files changed

+16
-44
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Alexander Ivanov
3+
Copyright (c) 2016 Alexander Ivanov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
1-
#pseudo-python
2-
3-
a python to pseudo translator
1+
[![Build Status](https://travis-ci.org/alehander42/pseudo-python.svg?branch=master)](https://travis-ci.org/alehander42/pseudo-python)
2+
[![MIT License](http://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
43

5-
Pseudo is a dynamic language intertranspiler: it can translate a subset of each supported language to a any of the others.
4+
#pseudo-python
65

7-
This Python to `Pseudo` translator would add automatic support for
8-
* Python to JavaScript
9-
* Python to C++
10-
* Python to C#
11-
* Python to Go
12-
* Python to Ruby
13-
* Python to any other pseudo-supported language
6+
A python to javascript / ruby / c++ / go / c# / php translator
147

15-
[pseudo compiler](https://github.com/alehander42/pseudo)
8+
[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
169

1710
## supported subset
1811

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:
2013

2114
* basic types and collections and standard library methods for them
2215

23-
* integer, float, string, boolean, nil
16+
* integer, float, string, boolean
2417
* lists
2518
* dicts
2619
* sets
27-
* tuples(fixed length heterogeneous lists)
20+
* tuples/structs(fixed length heterogeneous lists)
2821
* fixed size arrays
2922
* regular expressions
3023

@@ -36,38 +29,19 @@ This Python to `Pseudo` translator would add automatic support for
3629
* basically a constructor + a collection of instance methods, no fancy metaprogramming etc supported
3730

3831
* exception-based error handling with support for custom exceptions
32+
(target languages support return-based error handling too)
3933

4034
* io: print/input, file read/write, system and subprocess commands
4135

42-
* iteration (for-in-range / for-each / for-in-zip / while)
36+
* iteration (for-in-range / for-each / iterating over several collections / while)
4337
* conditionals (if / else if / else)
4438
* standard math/logical operations
4539

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-
6740
## pseudo-python compiler
6841

6942
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
7043

44+
[TODO]
7145
you can directly run `pseudo-python <filename.py> <lang>` e.g.
7246

7347
```bash
@@ -76,9 +50,13 @@ pseudo-python <filename.py> cpp
7650
```
7751
etc for all the supported pseudo languages (javascript, c++, c#, go, ruby and python)
7852

53+
## error messages
54+
7955
a lot of work has been put into making pseudo-python error messages as clear and helpful as possible: they show the offending snippet of code and
8056
often they offer suggestions, list possible fixes or right/wrong ways to write something
8157

58+
![Screenshot of error messages](http://i.imgur.com/8W7QNgZ.png)
59+
8260
## type inference
8361

8462
the rules are relatively simple: currently pseudo-python infers everything
@@ -126,9 +104,3 @@ but methods in children should accept the same types as their equivalents in the
126104
The easiest way to play with the type system is to just try several programs: `pseudo-python` errors should be enough to guide you, if not,
127105
you can always open an issue
128106

129-
## pseudo-python progress
130-
131-
- [x] type inference
132-
- [x] checks if return type is consistent
133-
- [x] infers collection element types
134-
- [x] infers class attributes and their types

0 commit comments

Comments
 (0)